What is the difference between Coyoneda and free-functors

As I know, we can get a functor through Koyoneda for free. But there is some haskell package http://hackage.haskell.org/package/free-functors

And my question is, what is the difference between Coyoneda and http://hackage.haskell.org/package/free-functors-0.8.1/docs/src/Data-Functor-Free.html#Free

+5
source share
1 answer

The key point here is understanding what means that the type constructor is not a functor. This means that it is defined on objects, and not on morphisms. But we can describe this as a functor if we choose a different category of sources. For each category C you can define a discrete category | C |, which has the same objects as C, but does not contain any morphisms other than identical morphisms. "Non-functional" is just a functor from | C | C. There is a trivial injection functor J from | C | to C, which is identical in objects and morphisms (of which there are only identical morphisms). So let's see:

Coyoneda is defined as the left extension of the Kahn functor f along the identity functor. This requires f to be a functor.

The free functor looks like Coyoneda, but it’s actually a left extension of Kan functor f from | C | on C along J. Strictly speaking, J is not identical, but it is close enough, hence the abuse of notes.

The free functor from the Sjurd-Vischer library expands this idea even further. Roughly speaking, a type class in Haskell defines a Hask subcategory. Its free functor is the left extension of the Kang functor f from this subcategory (or its discrete version) in Hask along the injection of this subcategory in Hask.

+7
source

Source: https://habr.com/ru/post/1275527/


All Articles