[Haskell-cafe] Functor and Haskell
westondan at imageworks.com
Tue Apr 21 19:01:47 EDT 2009
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?
More information about the Haskell-Cafe