free-4.2: Monads for free

Portability | MPTCs, fundeps
Stability | provisional
Maintainer | Edward Kmett <ekmett@gmail.com>
Safe Haskell | None

Control.Comonad.Trans.Coiter

Description

The iterative comonad generated by a comonad

Synopsis

- newtype CoiterT w a = CoiterT {
  - runCoiterT :: w (a, CoiterT w a)
  }
- class (Functor f, Comonad w) => ComonadCofree f w | w -> f where
  - unwrap :: w a -> f (w a)
- coiterT :: Comonad w => (w a -> a) -> w a -> CoiterT w a

# Documentation

newtype CoiterT w a Source

This is the (co?)iterative comonad generated by a comonad

Constructors

CoiterT |

Fields

runCoiterT :: w (a, CoiterT w a)

Instances

ComonadTrans CoiterT |
Comonad w => ComonadCofree Identity (CoiterT w) |
Functor w => Functor (CoiterT w) |
Typeable1 w => Typeable1 (CoiterT w) |
Foldable w => Foldable (CoiterT w) |
Traversable w => Traversable (CoiterT w) |
Comonad w => Comonad (CoiterT w) |
Eq (w (a, CoiterT w a)) => Eq (CoiterT w a) |
(Typeable1 w, Typeable a, Data (w (a, CoiterT w a)), Data a) => Data (CoiterT w a) |
Ord (w (a, CoiterT w a)) => Ord (CoiterT w a) |
Read (w (a, CoiterT w a)) => Read (CoiterT w a) |
Show (w (a, CoiterT w a)) => Show (CoiterT w a) |

class (Functor f, Comonad w) => ComonadCofree f w | w -> f where Source

Allows you to peel a layer off a cofree comonad.

Methods

unwrap :: w a -> f (w a)Source

Remove a layer.

Instances

ComonadCofree Maybe NonEmpty |
ComonadCofree f w => ComonadCofree f (IdentityT w) |
Functor f => ComonadCofree f (Cofree f) |
Comonad w => ComonadCofree Identity (CoiterT w) |
(ComonadCofree f w, Semigroup m, Monoid m) => ComonadCofree f (TracedT m w) |
ComonadCofree f w => ComonadCofree f (StoreT s w) |
ComonadCofree f w => ComonadCofree f (EnvT e w) |
(Functor f, Comonad w) => ComonadCofree f (CofreeT f w) |
ComonadCofree (Const b) ((,) b) |

coiterT :: Comonad w => (w a -> a) -> w a -> CoiterT w aSource

Unfold a `CoiterT` comonad transformer from a cokleisli arrow and an initial comonadic seed.