[Haskell-cafe] Functor and Haskell

wren ng thornton wren at freegeek.org
Tue Apr 21 23:03:12 EDT 2009

Daryoush Mehrtash wrote:
> I am not sure I follow how the endofunctor gave me the 2nd functor.
> As I read the transformation there are two catagories C and D and two
> functors F and G between the same two catagories.  My problem is that I only
> have one functor between the Hask and List catagories.  So where does the
> 2nd functor come into picture that also maps between the same C and D
> catagories?

You don't have a category List, you have the image of the List functor 
(in Hask). With the definition:

     data List a =...
     instance Functor List where fmap =...

The type constructor "List" provides the object half of an endofunctor 
on Hask, and the function "fmap @List" provides the morphism half of the 

Now, if you declare another endofunctor, G:

     data G a =...
     instance Functor G where fmap =...

then a natural transformation from List to G must provide a mapping 
(forall a. List a -> G a) for objects and a mapping (forall a b. (List a 
-> List b) -> (G a -> G b)) for morphisms, satisfying all the necessary 

Live well,

More information about the Haskell-Cafe mailing list