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

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Functor.Cofree

Contents

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 where Source

The cofree functor for constraint c.

Constructors

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

Instances

counit :: Cofree c b -> b Source

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

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

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

unit = leftAdjunct id

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

rightAdjunct f = counit . f

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

Products

type Product c m n = Cofree c (m, n) Source

product :: c a => (a -> m) -> (a -> n) -> a -> Product c m n Source

outL :: Product c m n -> m Source

outR :: Product c m n -> n Source

terminal :: c a => a -> TerminalObject c Source