Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
call :: (Carrier sig m, Member Cut sig) => m a -> m a Source #
Delimit the effect of cutfail
s, allowing backtracking to resume.
run (runNonDet (runCut (call (cutfail <|> pure a) <|> pure b))) == [b]
cut :: (Alternative m, Carrier sig m, Member Cut sig) => m () Source #
Commit to the current branch, preventing backtracking within the nearest enclosing call
(if any) on failure.
run (runNonDet (runCut (pure a <|> cut *> pure b))) == [a, b]
run (runNonDet (runCut (cut *> pure a <|> pure b))) == [a]
run (runNonDet (runCut (cut *> empty <|> pure a))) == []
runCut :: (Alternative m, Carrier sig m, Effect sig, Monad m) => Eff (CutC m) a -> m a Source #
Run a Cut
effect within an underlying Alternative
instance (typically Eff
carrying a NonDet
effect).
run (runNonDetOnce (runCut (pure a))) == Just a