[Haskell-beginners] Functors in Haskell
defigueiredo at ucdavis.edu
Tue Apr 29 18:12:15 UTC 2014
I'm trying to merge in my head the concepts of:
- functors from category theory; with,
- the Functor typeclass in haskell.
Here's what I have come up with:
A Functor F in haskell is a type constructor that provides a functor map
(fmap) and that maps Hask (the category of haskell types) into a
category generated by the Functor. For example, Maybe maps the category
of all haskell types "a" (i.e. Hask) into the category of all types of
the form "Maybe a" by providing an implementation of fmap.
Neglecting the fact that apparently Hask isn't a category, does this
sound reasonable? I think the insight for me here is that functors in
haskell are type constructors mapping Hask into another category. Is
that a good way to think about it?
More information about the Beginners