| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Control.Monad.Yield
Synopsis
- class Monad m => MonadYield (a :: Type) (m :: Type -> Type) | m -> a where
- yield :: a -> m ()
- data YieldT a m r
- runYieldT :: forall a b m r. Monad m => Aggregation m a b -> YieldT a m r -> m (b, r)
- hoistYieldT :: forall m n a r. Monad m => (forall x. m x -> n x) -> YieldT a m r -> YieldT a n r
- data Aggregation m a b = forall x.Aggregation {}
- noAggregation :: Applicative m => Aggregation m a ()
- seqAggregation :: Applicative m => Aggregation m a (Seq a)
- listAggregation :: Applicative m => Aggregation m a [a]
Class
class Monad m => MonadYield (a :: Type) (m :: Type -> Type) | m -> a where Source #
Instances
| Functor m => MonadYield a (YieldT a m) Source # | |
Defined in Control.Monad.Trans.Yield | |
Monad transformer
Monad transformer that adds dynamically interpretable MonadYield support
Instances
| MonadReader r m => MonadReader r (YieldT a m) Source # | |
| MonadState s m => MonadState s (YieldT a m) Source # | |
| Functor m => MonadYield a (YieldT a m) Source # | |
Defined in Control.Monad.Trans.Yield | |
| MonadTrans (YieldT a) Source # | |
Defined in Control.Monad.Trans.Yield | |
| MonadIO m => MonadIO (YieldT a m) Source # | |
Defined in Control.Monad.Trans.Yield | |
| Applicative (YieldT a m) Source # | |
Defined in Control.Monad.Trans.Yield | |
| Functor (YieldT a m) Source # | |
| Monad (YieldT a m) Source # | |
Arguments
| :: forall a b m r. Monad m | |
| => Aggregation m a b | What to do with the values emitted from the stream |
| -> YieldT a m r | |
| -> m (b, r) | The result of aggregating of stream values, and the result of the |
Runs a YieldT computation in the base monad
hoistYieldT :: forall m n a r. Monad m => (forall x. m x -> n x) -> YieldT a m r -> YieldT a n r Source #
Transforms a YieldT's base monad actions
Aggregation
data Aggregation m a b Source #
An effectful stream consumer
The type parameter x represents the consumer's internal state.
Constructors
| forall x. Aggregation | |
Instances
| Functor m => Functor (Aggregation m a) Source # | |
Defined in Control.Monad.Yield.Aggregation Methods fmap :: (a0 -> b) -> Aggregation m a a0 -> Aggregation m a b # (<$) :: a0 -> Aggregation m a b -> Aggregation m a a0 # | |
noAggregation :: Applicative m => Aggregation m a () Source #
seqAggregation :: Applicative m => Aggregation m a (Seq a) Source #
listAggregation :: Applicative m => Aggregation m a [a] Source #