logict-state-0.1.0.4: Library for logic programming based on haskell package logict

Safe HaskellSafe
LanguageHaskell2010

Control.Monad.TransLogicState.Class

Synopsis

Documentation

class TransLogicState s t where Source #

Additions to MonadTrans specifically useful for LogicState

Minimal complete definition

liftWithState

Methods

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 (gs, bs) (LogicStateT gs bs) Source # 

Methods

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.