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

Portabilitynon-portable
Stabilityexperimental
Maintainersjoerd@w3future.com
Safe HaskellNone

Data.Functor.Cofree

Description

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

Synopsis

Documentation

data Cofree c b whereSource

The cofree functor for constraint c.

Constructors

Cofree :: c a => (a -> b) -> a -> Cofree c b 

Instances

counit :: Cofree c b -> bSource

leftAdjunct :: c a => (a -> b) -> a -> Cofree c bSource

leftAdjunctF :: ForallF c f => (f a -> b) -> f a -> Cofree c bSource

unit :: c b => b -> Cofree c bSource

unit = leftAdjunct id

rightAdjunct :: (a -> Cofree c b) -> a -> bSource

rightAdjunct f = counit . f

convert :: (c (w a), Comonad w) => w a -> Cofree c aSource