Why Functor class has no return function?

前端 未结 4 1149
予麋鹿
予麋鹿 2020-12-06 00:43

From categorical point of view, functor is pair of two maps (one between objects and another between arrows of categories), following some axioms.

I have assumed, wh

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 01:16

    If you have

    instance Functor F where
        fmap = ...
    

    Then the type constructor F is the action on objects (which are types) taking a type T to the type F T, and fmap is the action on morphisms (which are functions) taking a function f :: T -> U to fmap f :: F T -> F U.

提交回复
热议问题