-
Notifications
You must be signed in to change notification settings - Fork 0
Type Notation
The "arrow" type constructor ->
denotes function application.
For example if an entity has type int -> int
it is a function that takes an int and returns an int.
Arrow type constructors are right-associative. As another example the function:
fn add(a, b) { a + b }
has type int -> int -> int
which you can parse as int -> (int -> int)
which makes sense in the presence of currying,
e.g. it is a function that takes an int and produces a function that takes an int and produces an int.
This notation is more useful when it is applied to more complex types, for example informally map is a function that takes a function and a list and produces another list, but more precisely we can say that map is a function that takes a function that transforms some type a into some type b, and a list of a's, and produces a list of b's. That can be expressed quite neatly with this notation as
(a -> b) -> list(a) -> list(b)
CEKF(s) a.k.a. F Natural a.k.a F♮