logict-state-0.1.1.0: Library for logic programming based on haskell package logict
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.LogicState.Class

Synopsis

Documentation

class (MonadLogic m, Monad ms, MonadState (f gs bs) m) => MonadLogicState f gs bs ms m | m -> ms where Source #

API for MonadLogic which allows state and backtracking on it.

Minimal complete definition

Nothing

Methods

backtrackWithRoll Source #

Arguments

:: (gs -> bs -> bs -> ms bs)

roll

-> m a 
-> m (m a) 

Return argument monad with the current backtrackable part of the state remembered. If the default def is not overridden this a no-op. This function complements mplus for LogicT, mplus backtracks on results, not on state, which is what this function should do. roll accepts the end state of the backtrack attempt resp the state to backtrack to, returns to state to backtrack to.

backtrack :: m a -> m (m a) Source #

special case of backtrackWith

Instances

Instances details
Monad m => MonadLogicState (,) gs bs m (LogicStateT gs bs m) Source # 
Instance details

Defined in Control.Monad.LogicState

Methods

backtrackWithRoll :: (gs -> bs -> bs -> m bs) -> LogicStateT gs bs m a -> LogicStateT gs bs m (LogicStateT gs bs m a) Source #

backtrack :: LogicStateT gs bs m a -> LogicStateT gs bs m (LogicStateT gs bs m a) Source #