Copyright | (c) 2019 Composewell Technologies |
---|---|

License | BSD-3-Clause |

Maintainer | streamly@composewell.com |

Stability | experimental |

Portability | GHC |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

Deprecated: Please use "Streamly.Data.Stream.*" instead.

## Synopsis

- hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> SerialT m a -> SerialT n a
- generally :: (IsStream t, Monad m) => t Identity a -> t m a
- liftInner :: (Monad m, IsStream t, MonadTrans tr, Monad (tr m)) => t m a -> t (tr m) a
- usingReaderT :: (Monad m, IsStream t) => m r -> (t (ReaderT r m) a -> t (ReaderT r m) a) -> t m a -> t m a
- runReaderT :: (IsStream t, Monad m) => m s -> t (ReaderT s m) a -> t m a
- evalStateT :: Monad m => m s -> SerialT (StateT s m) a -> SerialT m a
- usingStateT :: Monad m => m s -> (SerialT (StateT s m) a -> SerialT (StateT s m) a) -> SerialT m a -> SerialT m a
- runStateT :: Monad m => m s -> SerialT (StateT s m) a -> SerialT m (s, a)

# Generalize Inner Monad

hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> SerialT m a -> SerialT n a Source #

Transform the inner monad of a stream using a natural transformation.

* Internal*

generally :: (IsStream t, Monad m) => t Identity a -> t m a Source #

Generalize the inner monad of the stream from `Identity`

to any monad.

* Internal*

# Transform Inner Monad

liftInner :: (Monad m, IsStream t, MonadTrans tr, Monad (tr m)) => t m a -> t (tr m) a Source #

Lift the inner monad `m`

of a stream `t m a`

to `tr m`

using the monad
transformer `tr`

.

*Since: 0.8.0*

usingReaderT :: (Monad m, IsStream t) => m r -> (t (ReaderT r m) a -> t (ReaderT r m) a) -> t m a -> t m a Source #

runReaderT :: (IsStream t, Monad m) => m s -> t (ReaderT s m) a -> t m a Source #

Evaluate the inner monad of a stream as `ReaderT`

.

*Since: 0.8.0*

usingStateT :: Monad m => m s -> (SerialT (StateT s m) a -> SerialT (StateT s m) a) -> SerialT m a -> SerialT m a Source #

Run a stateful (StateT) stream transformation using a given state.

This is supported only for `SerialT`

as concurrent state updation may not be
safe.

usingStateT s f = evalStateT s . f . liftInner

See also: `scanl'`

* Internal*