Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

## Synopsis

- class TransLogicState s t where
- observe :: TransLogicState s t => s -> t Identity a -> a
- observeAll :: TransLogicState s t => s -> t Identity a -> [a]
- observeMany :: TransLogicState s t => s -> Int -> t Identity a -> [a]

# Documentation

class TransLogicState s t where Source #

Additions to MonadTrans specifically useful for LogicState

observeT :: Monad m => s -> t m a -> m a Source #

Extracts the first result from a 't m' computation, failing otherwise.

observeAllT :: Monad m => s -> t m a -> m [a] Source #

Extracts all results from a 't m' computation.

observeStateAllT :: Monad m => s -> t m a -> m ([a], s) Source #

Extracts all results from a 't m' computation.

observeManyT :: forall m a. Monad m => s -> Int -> t m a -> m [a] Source #

Extracts up to a given number of results from a 't m' computation.

observeStateManyT :: forall m a. Monad m => s -> Int -> t m a -> m ([a], s) Source #

Extracts up to a given number of results from a 't m' computation.

liftWithState :: Monad m => (s -> m (a, s)) -> t m a Source #

Lift a monad by threading the state available in the transformed monad through it

## Instances

TransLogicState () LogicT Source # | |

Defined in Control.Monad.LogicState.Logic observeT :: Monad m => () -> LogicT m a -> m a Source # observeAllT :: Monad m => () -> LogicT m a -> m [a] Source # observeStateAllT :: Monad m => () -> LogicT m a -> m ([a], ()) Source # observeManyT :: Monad m => () -> Int -> LogicT m a -> m [a] Source # observeStateManyT :: Monad m => () -> Int -> LogicT m a -> m ([a], ()) Source # liftWithState :: Monad m => (() -> m (a, ())) -> LogicT m a Source # | |

TransLogicState (gs, bs) (LogicStateT gs bs) Source # | |

Defined in Control.Monad.LogicState observeT :: Monad m => (gs, bs) -> LogicStateT gs bs m a -> m a Source # observeAllT :: Monad m => (gs, bs) -> LogicStateT gs bs m a -> m [a] Source # observeStateAllT :: Monad m => (gs, bs) -> LogicStateT gs bs m a -> m ([a], (gs, bs)) Source # observeManyT :: Monad m => (gs, bs) -> Int -> LogicStateT gs bs m a -> m [a] Source # observeStateManyT :: Monad m => (gs, bs) -> Int -> LogicStateT gs bs m a -> m ([a], (gs, bs)) Source # liftWithState :: Monad m => ((gs, bs) -> m (a, (gs, bs))) -> LogicStateT gs bs m a Source # |

observe :: TransLogicState s t => s -> t Identity a -> a Source #

Extracts the first result from a LogicVar computation.

observeAll :: TransLogicState s t => s -> t Identity a -> [a] Source #

Extracts all results from a LogicVar computation.

observeMany :: TransLogicState s t => s -> Int -> t Identity a -> [a] Source #

Extracts up to a given number of results from a LogicVar computation.