[Haskell-beginners] Functors in Haskell
rein.henrichs at gmail.com
Tue Apr 29 18:35:30 UTC 2014
Yes, this is reasonable, but it might be useful to be a bit more explicit
about the categories involved.
An instance of Functor is a functor which maps objects and arrows in the
category of Hask (of Haskell types and functions) to... objects and arrows
in the category of Hask. It is an endofunctor. The object mapping must map
a type to a type and therefore must have the kind * -> *. This means that
it is a type constructor, e.g., Maybe. The arrow mapping must map arrows to
arrows, which means it must map functions to functions. fmap provides this
mapping and the Functor laws in Haskell are of course equivalent to the
laws from category theory.
And while the inclusion of bottom is problematic for Hask, it is still
possible to reason about it in a "morally correct" way (
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners