logict-sequence-0.2.0.1: A backtracking logic-programming monad with asymptotic improvements to msplit
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Logic.Sequence.Morph

Description

This module provides functions for changing the underlying monad of a SeqT, just like Control.Monad.Morph.hoist.

The functions with the word "Pre" in their names lean on the Monad instance of the original monad. The ones with the word "Post" in their names lean on the Monad instance of the target monad. The ones with the word "Unexposed" in their names are reasonably well-behaved when the passed function is not a monad morphism (as described in the Control.Monad.Morph documentation). The others are typically a little more efficient, but may behave strangely when passed non-monad-morphisms. In particular, if f is not a monad morphism, and s1 == s2, we do not even guarantee that hoistPre f s1 == hoistPre f s2.

Synopsis

Documentation

hoistPreUnexposed :: forall m n a. Monad m => (forall x. m x -> n x) -> SeqT m a -> SeqT n a Source #

A version of hoist that works for arbitrary functions, rather than just monad morphisms.

hoistPost :: Monad n => (forall x. m x -> n x) -> SeqT m a -> SeqT n a Source #

A version of hoist that uses the Monad instance for n rather than for m. Like hoist, the passed function is required to be a monad morphism.

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

A version of hoistPost that works for arbitrary functions, rather than just monad morphisms. This should be preferred when the Monad instance for n is less expensive than that for m.

hoistPre :: Monad m => (forall x. m x -> n x) -> SeqT m a -> SeqT n a Source #

This function is the implementation of hoist for SeqT. The passed function is required to be a monad morphism.