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

Portabilitynon-portable
Stabilityexperimental
Maintainersjoerd@w3future.com
Safe HaskellSafe-Inferred

Data.Functor.HCofree

Description

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.

Synopsis

Documentation

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.

Constructors

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

Instances

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