backtracking-0.1.0: A backtracking monad

Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Search

Description

 
Synopsis

Documentation

class MonadPlus m => MonadSearch m where Source #

MonadSearch represents searches with backtracking.

Minimal complete definition

fromList, toList

Methods

fromList :: [a] -> m a Source #

toList :: m a -> [a] Source #

failure :: m a -> Bool Source #

failure :: m a -> Bool Source #

lnot :: DFS a -> m () Source #

lnot :: DFS a -> m () Source #

guard :: Bool -> m () Source #

guard :: Bool -> m () Source #

Instances
MonadSearch BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fromList :: [a] -> BFS a Source #

toList :: BFS a -> [a] Source #

failure :: BFS a -> Bool Source #

lnot :: DFS a -> BFS () Source #

guard :: Bool -> BFS () Source #

MonadSearch DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fromList :: [a] -> DFS a Source #

toList :: DFS a -> [a] Source #

failure :: DFS a -> Bool Source #

lnot :: DFS a -> DFS () Source #

guard :: Bool -> DFS () Source #

data DFS a Source #

DFS implementation of MonadSearch.

Instances
Monad DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

(>>=) :: DFS a -> (a -> DFS b) -> DFS b #

(>>) :: DFS a -> DFS b -> DFS b #

return :: a -> DFS a #

fail :: String -> DFS a #

Functor DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fmap :: (a -> b) -> DFS a -> DFS b #

(<$) :: a -> DFS b -> DFS a #

Applicative DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

pure :: a -> DFS a #

(<*>) :: DFS (a -> b) -> DFS a -> DFS b #

liftA2 :: (a -> b -> c) -> DFS a -> DFS b -> DFS c #

(*>) :: DFS a -> DFS b -> DFS b #

(<*) :: DFS a -> DFS b -> DFS a #

Alternative DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

empty :: DFS a #

(<|>) :: DFS a -> DFS a -> DFS a #

some :: DFS a -> DFS [a] #

many :: DFS a -> DFS [a] #

MonadPlus DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

mzero :: DFS a #

mplus :: DFS a -> DFS a -> DFS a #

MonadSearch DFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fromList :: [a] -> DFS a Source #

toList :: DFS a -> [a] Source #

failure :: DFS a -> Bool Source #

lnot :: DFS a -> DFS () Source #

guard :: Bool -> DFS () Source #

dfs :: a -> DFS a Source #

data BFS a Source #

BFS implementation of MonadSearch.

Instances
Monad BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

(>>=) :: BFS a -> (a -> BFS b) -> BFS b #

(>>) :: BFS a -> BFS b -> BFS b #

return :: a -> BFS a #

fail :: String -> BFS a #

Functor BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fmap :: (a -> b) -> BFS a -> BFS b #

(<$) :: a -> BFS b -> BFS a #

Applicative BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

pure :: a -> BFS a #

(<*>) :: BFS (a -> b) -> BFS a -> BFS b #

liftA2 :: (a -> b -> c) -> BFS a -> BFS b -> BFS c #

(*>) :: BFS a -> BFS b -> BFS b #

(<*) :: BFS a -> BFS b -> BFS a #

Alternative BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

empty :: BFS a #

(<|>) :: BFS a -> BFS a -> BFS a #

some :: BFS a -> BFS [a] #

many :: BFS a -> BFS [a] #

MonadPlus BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

mzero :: BFS a #

mplus :: BFS a -> BFS a -> BFS a #

MonadSearch BFS Source # 
Instance details

Defined in Control.Monad.Search

Methods

fromList :: [a] -> BFS a Source #

toList :: BFS a -> [a] Source #

failure :: BFS a -> Bool Source #

lnot :: DFS a -> BFS () Source #

guard :: Bool -> BFS () Source #

bfs :: a -> BFS a Source #