[Haskell-cafe] Relating functors in Category Theory to Functor
Iavor S. Diatchki
diatchki at cse.ogi.edu
Tue Jun 29 12:46:09 EDT 2004
hi,
just a few silly remarks...
ajb at spamcop.net wrote:
>>For two functors F, G: C -> D, there is a natural transformation tau
>>from F to G, if for every object a in C, there is morphism tau[a]: F(a)
>>-> G(a) in D.
>>
>>In Haskell, natural transformations are polymorphic functions, tau :: f
>>a -> g a. For example, maybeToList :: Maybe a -> [a].
>>
>>
actually i think this is a good approximation. not all polymorphic
functions are natural
transformations, but "simple" ones usually are.
>Not quite. A natural transformation is a mapping between _functors_.
>In this case, maybeToList is a natural transformation between Maybe
>and []. Expressing this as a typeclass is left as an exercise, but
>here's a start:
>
> class (Functor f, Functor g) => NaturalTransformation ... where
> ...
>
>
it is not a good idea to have a _class_ for natural transformations as
they have little to do with overloading.
there can be many different natural transformations between two
functors, so it does not make sense
to give them all the same name.
-iavor
More information about the Haskell-Cafe
mailing list