[Haskell-cafe] Functor and Haskell

Daryoush Mehrtash dmehrtash at gmail.com
Thu Apr 23 14:44:48 EDT 2009

Thanks for this example I get the point now. (at least i think i do :) )

One more question.... This all being on the same category then the functor
transformation can also be view as a simple morphism too.  In this example
the listToMaybe can be viewed as morphism between list and Maybe types that
are both in the Hask categroy too. right?     If so then what would viewing
the morphism as natural transformation by you?



P.S.  for others interested in the same topic I found this on Haskell wikis
that add some more detail:

On Wed, Apr 22, 2009 at 3:40 PM, Ross Paterson <ross at soi.city.ac.uk> wrote:

> On Wed, Apr 22, 2009 at 03:14:03PM -0700, Daryoush Mehrtash wrote:
> > The Haskell Wikibooks also says the same thing:
> >
> >     Functors in Haskell are from Hask to func, where func is the
> >     subcategory of Hask defined on just that functor's types. E.g. the
> >     list functor goes from Hask to Lst, where Lst is the category
> >     containing only list types, that is, [T] for any type T. The
> >     morphisms in Lst are functions defined on list types, that is,
> >     functions [T] -> [U] for types T, U.
> That's true, but not a particularly helpful view.  Any functor F : C -> D
> can be viewed as a functor from C to the full subcategory of D on objects
> of the form F A for A an object of C.  But then different functors map to
> different categories and you can't talk about natural transformations
> between them.  Composing functors also becomes impossible.
> The simple view is that [], Maybe and Id are all functors from Hask to
> Hask.  Then listToMaybe :: [a] -> Maybe a is a natural transformation
> from [] to Maybe, because
>        fmap f . listToMaybe = listToMaybe . map f
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090423/a00e29dc/attachment.htm

More information about the Haskell-Cafe mailing list