->
is an infix type constructor. You can compare it with :
- an infix value constructor for list type. To use :
alone we put parentheses around it so it becomes a prefix function application:
(:) a b
is the same as a : b
Similarly, (->) a b
is the same as a -> b
, type of a function from a
to b
.
(->) a
is a partial application of type constructor, and itself a type constructor of kind * -> *
.
You can think of it as "a constructor of types of functions from a". E.g. (->) Int
is a constructor of types of functions from Int
. You can construct full function type by passing another type to it: (->) Int String
is the type of functions from Int
to String
.
instance Functor (->) a
is a functor with fmap
operation transforming an a -> b
function into an a -> c
function. You can compare it with a similar instance Functor (Either a)
which maps Either a b
to Either a c
by applying the fmap
argument to Right
values.