free-functors-0.8.3: Free functors, adjoint to functors that forget class constraints.

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
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

(ForallF * * c Identity, ForallF * * c (Compose * * (Cofree c) (Cofree c))) => Monad (Cofree c) Source # 

Methods

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

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

return :: a -> Cofree c a #

fail :: String -> Cofree c a #

Functor (Cofree c) Source # 

Methods

fmap :: (a -> b) -> Cofree c a -> Cofree c b #

(<$) :: a -> Cofree c b -> Cofree c a #

(ForallF * * c Identity, ForallF * * c (Compose * * (Cofree c) (Cofree c))) => Applicative (Cofree c) Source # 

Methods

pure :: a -> Cofree c a #

(<*>) :: Cofree c (a -> b) -> Cofree c a -> Cofree c b #

liftA2 :: (a -> b -> c) -> Cofree c a -> Cofree c b -> Cofree c c #

(*>) :: Cofree c a -> Cofree c b -> Cofree c b #

(<*) :: Cofree c a -> Cofree c b -> Cofree c a #

Comonad (Cofree c) Source # 

Methods

extract :: Cofree c a -> a #

duplicate :: Cofree c a -> Cofree c (Cofree c a) #

extend :: (Cofree c a -> b) -> Cofree c a -> Cofree c b #

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 #