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

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

Data.Functor.HFree

Description

A free functor is left adjoint to a forgetful functor. In this package the forgetful functor forgets class constraints.

Compared to Data.Functor.Free 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.

newtype HFree c f a Source

The higher order free functor for constraint c.

Constructors

HFree 

Fields

runHFree :: forall g. (c g, Functor g) => (f :~> g) -> g a
 

Instances

rightAdjunct :: (c g, Functor g) => (f :~> g) -> HFree c f :~> gSource

counit :: (c f, Functor f) => HFree c f :~> fSource

counit = rightAdjunct id

leftAdjunct :: (HFree c f :~> g) -> f :~> gSource

leftAdjunct f = f . unit

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

liftFree :: f a -> HFree c f aSource

lowerFree :: (c f, Functor f) => HFree c f a -> f aSource

convert :: (c (t f), Functor (t f), Monad f, MonadTrans t) => HFree c f a -> t f aSource

iter :: c Identity => (forall b. f b -> b) -> HFree c f a -> aSource

wrap :: f (HFree Monad f a) -> HFree Monad f aSource