Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
More generic lifting combinators.
This module contains more generic lifting combinators. It includes several implementations, and obviously should be considered work in progress. The goal is to make this both simple and conceptually understandable.
- lifterS :: (Monad m, Monad m1) => ((a1 -> m1 (b1, MSF m1 a1 b1)) -> a -> m (b, MSF m1 a1 b1)) -> MSF m1 a1 b1 -> MSF m a b
- transS :: (Monad m1, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2
- transG1 :: (Monad m1, Functor m2, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2
- transG :: (Monad m1, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, Maybe c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2
Documentation
lifterS :: (Monad m, Monad m1) => ((a1 -> m1 (b1, MSF m1 a1 b1)) -> a -> m (b, MSF m1 a1 b1)) -> MSF m1 a1 b1 -> MSF m a b Source #
Lifting combinator to move from one monad to another, if one has a
function to run computations in one monad into another. Note that, unlike a
polymorphic lifting function forall a . m a -> m1 a
, this auxiliary
function needs to be a bit more structured.
transS :: (Monad m1, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2 Source #
Lifting combinator to move from one monad to another, if one has a
function to run computations in one monad into another. Note that, unlike a
polymorphic lifting function forall a . m a -> m1 a
, this auxiliary
function needs to be a bit more structured, although less structured than
lifterS
.
transG1 :: (Monad m1, Functor m2, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2 Source #
Lifting combinator to move from one monad to another, if one has a
function to run computations in one monad into another. Note that, unlike a
polymorphic lifting function forall a . m a -> m1 a
, this auxiliary
function needs to be a bit more structured, although less structured than
lifterS
.
transG :: (Monad m1, Monad m2) => (a2 -> m1 a1) -> (forall c. a2 -> m1 (b1, c) -> m2 (b2, Maybe c)) -> MSF m1 a1 b1 -> MSF m2 a2 b2 Source #
More general lifting combinator that enables recovery. Note that, unlike a
polymorphic lifting function forall a . m a -> m1 a
, this auxiliary
function needs to be a bit more structured, and produces a Maybe value. The
previous MSF is used if a new one is not produced.