monoids-in-the-category-of-.../src/Functor/Distributive.hs

10 lines
317 B
Haskell

module Functor.Distributive where
import Functor.Base
import Relation
class Endofunctor f => Distributive f where
distribute :: (Endofunctor g, Cod f ~ Cod g) => Cod f (f (g a)) (g (f a))
collect :: (Endofunctor g, Cod f ~ Cod g) => Cod f a (g b) -> Cod f (f a) (g (f b))
collect f = distribute . map f