November 2015
Intermediate to advanced
166 pages
3h 14m
English
Typeclasses with one type parameter are of kind (* -> *), for example:
class Show a :: * -> * class Maybe a :: * -> *
If we declare an instance of Show, then the typeclass parameters in the kind signatures need to be aligned, for example, consider:
instance (Show a) => Show (Maybe a) where ...
In order to match the kind of a :: * in Show a, we use Maybe' b instead of Maybe:
Maybe' b :: * -- instead of Maybe :: (* -> *)
The Monad type-class is of a higher-order than Show and Maybe:
class Monad m :: (* -> *) -> * -- m -> Monad m
The Show type-class is parameterized over type a :: *; whereas Monad is parameterized over the type constructor m :: * -> *. This can seem like a natural and unsurprising generalization for type-classes, ...
Read now
Unlock full access