Portability | non-portable |
---|---|

Stability | experimental |

Maintainer | sjoerd@w3future.com |

Safe Haskell | Safe-Inferred |

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

- data Cofree c b where
- counit :: Cofree c b -> b
- leftAdjunct :: c a => (a -> b) -> a -> Cofree c b
- leftAdjunctF :: ForallF c f => (f a -> b) -> f a -> Cofree c b
- unit :: c b => b -> Cofree c b
- rightAdjunct :: (a -> Cofree c b) -> a -> b
- convert :: (c (w a), Comonad w) => w a -> Cofree c a
- type Product c m n = Cofree c (m, n)
- product :: c a => (a -> m) -> (a -> n) -> a -> Product c m n
- outL :: Product c m n -> m
- outR :: Product c m n -> n
- type TerminalObject c = Cofree c ()
- terminal :: c a => a -> TerminalObject c

# Documentation

The cofree functor for constraint `c`

.

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

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

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

rightAdjunct f = counit . f

# Products

type TerminalObject c = Cofree c ()Source

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