MonadCompose-0.7.0.0: Methods for composing monads.

Safe HaskellSafe-Inferred
LanguageHaskell98

Control.Monad.Distributive

Synopsis

Documentation

swap :: (t1, t) -> (t, t1) Source

class MonadTrans m => Takeout m y | m -> y where Source

Methods

takeout :: Monad n => m n t -> m Identity (n (y t)) Source

Pop out the underlying monad of a transformer, with a data structure to hold the state.

combine :: Monad x => m x (y t) -> m x t Source

Put the data structure back in.

Instances

putin :: (MonadTrans t1, MonadTrans t, MFunctor t1, MFunctor t, Monad (t1 n), Monad (t (t1 n)), Monad (t n), Monad n) => t n (t1 Identity b) -> t (t1 n) b Source

The opposite of takeout.

putin1 :: (MonadTrans t, MFunctor t, Monad (t n), Monad n) => t Identity (n b) -> t n b Source

class Leftdistr m where Source

Transformers that distribute over one another.

For reorganizing a monad stack.

Methods

ldist :: (Monad (n x), Monad x) => m (n x) t -> n x (m Identity t) Source

class Rightdistr m where Source

Methods

rdist :: (Monad (n Identity), Monad (n x), MonadTrans n, MFunctor n, Monad x) => n Identity (m x t) -> m (n x) (n x t) Source

ldist' :: (Leftdistr t1, MonadTrans t1, MonadTrans t, MFunctor t1, MFunctor t, Monad (t1 n), Monad (t (t1 n)), Monad (t n), Monad n) => t1 (t n) b -> t (t1 n) b Source

Left distributivity of a monad transformer.

rdist' :: (Takeout m y, Rightdistr m1, MonadTrans m1, MFunctor m, Monad (m1 (m x)), Monad (m1 x), Monad (m Identity), Monad (m x), Monad x) => m (m1 x) b -> m1 (m x) b Source

Right distributivity.