After studying the category theory based on MacLane, Awodey and Spivak books, I'm trying to understand free/operational monad in Haskell.
We can get a monad from just a data type by using Control.Monad.Free
after transforming it to a functor with Data.Functor.Coyoneda
, which is based on the mathematical background called Yoneda lemma.
But I'm not fully understanding the functor can be automatically generated by the deriving functor extension in GHC instead of relying on Yoneda lemma.
Is there any restriction to use the deriving functor in GHC compared to Data.Functor.Coyoneda
?