| |||||||||||||||||||||

| |||||||||||||||||||||

| |||||||||||||||||||||

Description | |||||||||||||||||||||

This module is part of StrategyLib, a library of functional strategy combinators, including combinators for generic traversal. This module provides combinators to localize monadic effects. | |||||||||||||||||||||

Synopsis | |||||||||||||||||||||

| |||||||||||||||||||||

Replace one strategy monad by another | |||||||||||||||||||||

mrunTP :: (Monad m, Monad m', MonadRun s m) => (forall a . s a a) -> TP m -> TP m' | |||||||||||||||||||||

Replace the monad in a type-preserving strategy, given a monad
algebra (see MonadRun) for the monad that is replaced. The two
monads are unrelated, so none of the effects in the monad that is
replaced carry over to the one that replaces it.
| |||||||||||||||||||||

mrunTU :: (Monad m, Monad m', MonadRun s m) => s a a -> TU a m -> TU a m' | |||||||||||||||||||||

Replace the monad in a type-unifying strategy, given a monad
algebra (see MonadRun) for the monad that is replaced. The two
monads are unrelated, so none of the effects in the monad that is
replaced carry over to the one that replaces it.
| |||||||||||||||||||||

Add an effect to the strategy monad | |||||||||||||||||||||

liftTP :: (Monad (t m), Monad m, MonadTrans t) => TP m -> TP (t m) | |||||||||||||||||||||

Add an effect to the monad in a type-preserving strategy.
The monads are related by a monad transformer, so the effects of the
incoming monad are preserved in the result monad. We use the lift
function of the monad transformer.
| |||||||||||||||||||||

liftTU :: (Monad (t m), Monad m, MonadTrans t) => TU a m -> TU a (t m) | |||||||||||||||||||||

Add an effect to the monad in a type-unifying strategy.
The monads are related by a monad transformer, so the effects of the
incoming monad are preserved in the result monad. We use the lift
function of the monad transformer.
| |||||||||||||||||||||

Remove an effect from the strategy monad | |||||||||||||||||||||

unliftTP :: (Monad (t m), Monad m, MonadUnTrans s t) => (forall a . s a a) -> TP (t m) -> TP m | |||||||||||||||||||||

remove an effect from the monad of a type-preserving strategy.
The monads are related by a monad untransformer (see MonadUnTrans),
so the effects of the incoming monad are preserved in the result
monad, except for the effect for which a monad algebra is supplied.
| |||||||||||||||||||||

unliftTU :: (Monad (t m), Monad m, MonadUnTrans s t) => s a a -> TU a (t m) -> TU a m | |||||||||||||||||||||

remove an effect from the monad of a type-unifying strategy.
The monads are related by a monad untransformer (see MonadUnTrans),
so the effects of the incoming monad are preserved in the result
monad, except for the effect for which a monad algebra is supplied.
| |||||||||||||||||||||

Localize specific effects | |||||||||||||||||||||

Localize the partiality effect | |||||||||||||||||||||

guaranteeSuccessTP | |||||||||||||||||||||

| |||||||||||||||||||||

guaranteeSuccessTU | |||||||||||||||||||||

| |||||||||||||||||||||

unsafeGuaranteeSuccessTP :: (Monad (t m), Monad m, MonadUnTrans MaybeAlg t) => TP (t m) -> TP m | |||||||||||||||||||||

Unsafe version of guaranteeSuccessTP. This version uses uses undefined
to recover from failure. For the type-preserving case, this is the only
possible default value.
| |||||||||||||||||||||

Localize the state effect | |||||||||||||||||||||

localStateTP :: (Monad (t m), Monad m, MonadUnTrans (StateAlg s) t) => s -> TP (t m) -> TP m | |||||||||||||||||||||

Localize the state of a type-preserving strategy. The first argument represents the initial state. | |||||||||||||||||||||

localStateTU :: (Monad (t m), Monad m, MonadUnTrans (StateAlg s) t) => s -> TU a (t m) -> TU a m | |||||||||||||||||||||

Localize the state of a type-unifying strategy. The first argument represents the initial state. | |||||||||||||||||||||

Produced by Haddock version 0.8 |