In the paper, def. 3.34. folds are described as optics for the action of foldable functors. However, there is no Functor superclass constraint on Foldable in Haskell.
Unfortunately, while it seems that we can define a category for Foldables, the monoidal category seems to require the functoriality of the objects because otherwise the bifunctor Compose and the bifunctor App cannot be implemented (it might be possible using coercions but I don't know if that forms a proper functor). EDIT: it is not possible to implement either of the bifunctors, even with coercions.
Is there a way to define folds as optics without reaching for functors?
In the paper, def. 3.34. folds are described as optics for the action of foldable functors. However, there is no
Functorsuperclass constraint onFoldablein Haskell.Unfortunately, while it seems that we can define a category for
Foldables, the monoidal category seems to require the functoriality of the objects because otherwise the bifunctorComposeand the bifunctorAppcannot be implemented (it might be possible using coercions but I don't know if that forms a proper functor). EDIT: it is not possible to implement either of the bifunctors, even with coercions.Is there a way to define folds as optics without reaching for functors?