
Daryoush Mehrtash
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?
The type constructors map objects from C to objects from F(C). The 'fmap' function maps morphisms from C to morphisms from F(C). You can see this immediately by looking at the type of 'fmap' (note that (->) is right-associative): fmap :: Functor f => (a -> b) -> (f a -> f b) Greets, Ertugrul. -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://blog.ertes.de/