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

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

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

Products

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

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

outL :: Product c m n -> mSource

outR :: Product c m n -> nSource