[Haskell-cafe] Functor and Haskell

Daryoush Mehrtash dmehrtash at gmail.com
Tue Apr 21 20:18:12 EDT 2009


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?

Thanks

Daryoush



On Tue, Apr 21, 2009 at 4:01 PM, Dan Weston <westondan at imageworks.com>wrote:

> You are on the right track. The usual construction is that Hask is the
> category (with types as objects and functions as morphisms).
>
> Functor F is then an endofunctor taking Hask to itself:
>
> a -> F a
> f -> fmap f
>
> So, for F = []:
>
> a -> [a]
> f -> map f
>
> Natural transformations are then any fully polymorphic (no context) unary
> function. The polymorphism is what makes them natural, since there is no
> method to treat one object (type) different from another.
>
>
> Daryoush Mehrtash wrote:
>
>> In category theory functors are defined between two category of C and D
>> where every object and morphism from C is mapped to D.
>>
>> I am trying to make sense of the above definition with functor class in
>> Haskell.   Let say I am dealing with List type.  When I define List to be a
>> instance of a functor I am saying the source category (C) is Haskell types
>> and the destination category is List (D).    In this the "fmap" is
>> implementation of the mapping between every morphism in my Haskell Categroy
>> (C) to morphism in  List cataegory (D).   With type constructor I also have
>> the mapping of types (objects in Haskell Category, or my source cataegroy C)
>> to List category (D).  So my functor in the catarogy sense is actually the
>> fmap and type constructor.  Am I remotely correct?
>>
>> If this is correct.... With this example, then can you then help me
>> understand the transformation between functors and natural transformations?
>>     Specifically, what does it means to have two different functors between
>> Haskell cateogry and List category?
>> Thanks,
>>
>> Daryoush
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090421/1f543c44/attachment.htm


More information about the Haskell-Cafe mailing list