free-functors-0.2: Provides free functors that are adjoint to functors that forget class constraints.

Safe HaskellNone



A cofree functor is right adjoint to a forgetful functor. In this package the forgetful functor forgets class constraints.

Compared to Data.Functor.Cofree we're going up a level. These free functors go between categories of functors and the natural transformations between them.



type :~> f g = forall b. f b -> g bSource

Natural transformations.

data HCofree c g a whereSource

The higher order cofree functor for constraint c.


HCofree :: (c f, Functor f) => (f :~> g) -> f a -> HCofree c g a 


leftAdjunct :: (c f, Functor f) => (f :~> g) -> f :~> HCofree c gSource

unit :: (c g, Functor g) => g :~> HCofree c gSource

unit = leftAdjunct id

rightAdjunct :: (f :~> HCofree c g) -> f :~> gSource

rightAdjunct f = counit . f

hfmap :: (f :~> g) -> HCofree c f :~> HCofree c gSource

liftCofree :: (c f, Functor f) => f a -> HCofree c f aSource

lowerCofree :: HCofree c f a -> f aSource

coiter :: c Identity => (forall b. b -> f b) -> a -> HCofree c f aSource