Skip to main content

Type and kind

Type constructors take other types as parameters to produce concrete types. f Functions take values as parameters to produce values Function can be partially applied, same for type constructor

We used :k on a type to get its kind, just like we can use :t on a value to get its type.

class Functor f where
map :: (a -> b) -> f a -> f b

All are types in function declaration: (a->b), f a, f b

:k (f a)= Type, so :k f = Type->Type

types are the labels of values and kinds are the labels of types

ghci> :k Functor
Functor :: (* -> *) -> Constraint
> :k Functor
Error found:
in module $PSCI
at :1:1 - 1:8 (line 1, column 1 - line 1, column 8)
>
Unknown type Functor