In ghci :i Functor gives me:
class Functor (f :: * -> *) where
fmap :: (a -> b) -> f a -> f b
...
What does (f :: * -> *) mean? It looks as if f needs to be a function, but that doesn't make sense.
The asterisk * is the Haskell symbol for kinds, the "types of types".
Prelude> :k Int
Int :: *
Prelude> :k Maybe
Maybe :: * -> *
Prelude> :k []
[] :: * -> *
Prelude> :k Maybe Int
Maybe Int :: *
The Functor class is defined for type constructors of kind * -> *, which take one type and return a type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With