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

Stability | experimental |

Maintainer | sjoerd@w3future.com |

Safe Haskell | None |

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

Compared to `Data.Functor.Cofree`

we're going up a level.
These free functors go between categories of functors and the natural
transformations between them.

- type :~> f g = forall b. f b -> g b
- data HCofree c g a where
- counit :: HCofree c g :~> g
- leftAdjunct :: (c f, Functor f) => (f :~> g) -> f :~> HCofree c g
- unit :: (c g, Functor g) => g :~> HCofree c g
- rightAdjunct :: (f :~> HCofree c g) -> f :~> g
- hfmap :: (f :~> g) -> HCofree c f :~> HCofree c g
- liftCofree :: (c f, Functor f) => f a -> HCofree c f a
- lowerCofree :: HCofree c f a -> f a
- coiter :: c Identity => (forall b. b -> f b) -> a -> HCofree c f a
- unwrap :: HCofree Comonad g a -> g (HCofree Comonad g a)

# Documentation

data HCofree c g a whereSource

The higher order cofree functor for constraint `c`

.

Functor (HCofree c g) | |

Foldable (HCofree Foldable g) | |

Foldable (HCofree Traversable g) | |

Traversable (HCofree Traversable g) | |

Comonad (HCofree Comonad g) | The cofree comonad of a functor. |

rightAdjunct :: (f :~> HCofree c g) -> f :~> gSource

rightAdjunct f = counit . f

liftCofree :: (c f, Functor f) => f a -> HCofree c f aSource

lowerCofree :: HCofree c f a -> f aSource