Are all Haskell functors endofunctors?

后端 未结 3 854
小鲜肉
小鲜肉 2021-01-30 17:16

I\'m a bit confused, and need someone to set me straight. Lets outline my current understanding:

Where E is an endofunctor, and A is some categ

3条回答
  •  爱一瞬间的悲伤
    2021-01-30 17:53

    Even if ultimately, you manipulate Hask, there are a lot of other categories that can be built on Hask, which can be meaningful for the problem at hand:

    • Hask^op, which is Hask with all arrows reversed
    • Hask * Hask, functors on it are bifunctors
    • Comma categories, ie. objects are morphisms to a fixed object a, morphisms are commutative triangles
    • Functor categories, morphisms are natural transformations
    • Algebra categories
    • Monoidal categories
    • Kleisli categories
    • ...

    grab a copy of Mac Lane's Categories for the Working Mathematician to have definitions, and try to find by yourself the problem they solve in Haskell. Especially choke on adjoint functors (which are initial/terminal objects in the right category) and their relationship with monads.

    You'll see that even if there is one big category (Hask, or perhaps "lifted objects from Hask with the right arrows/products/...", which encapsulates the language choices of Haskell such as non-strictness and lazyness), proper derived categories are expressive.

提交回复
热议问题