[Haskell-cafe] Relating functors in Category Theory to Functor
Frank Atanassow
franka at cs.uu.nl
Fri Jul 2 07:45:06 EDT 2004
On Jun 29, 2004, at 6:46 PM, Iavor S. Diatchki wrote:
>>> 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.
I think you have it backwards, unless you are thinking of a more
general notion of polymorphism than parametric polymorphism.
Ad hoc polymorphic functions may or may not be natural; you have to
verify the naturality condition in each case.
But every parametrically polymorphic function is a natural
transformation, though the converse fails: not every natural
transformation is parametrically polymorphic. In particular, some
natural transformations are generic functions (polytypic), and their
components (instantiations at a type) are not all instances of a single
algorithm.
I'm not sure if every natural transformation on endofunctors on a
category modelling a Haskell-like language is denoted by either a
parametric or generic term.
Regards,
Frank
More information about the Haskell-Cafe
mailing list