ghc-8.4.1: The GHC API

Copyright(c) Dan Doel
LicenseBSD3
Maintainerdan.doel@gmail.com
Stabilityexperimental
Portabilitynon-portable (multi-parameter type classes)
Safe HaskellSafe
LanguageHaskell2010

ListT

Description

A backtracking, logic programming monad.

Adapted from the paper /Backtracking, Interleaving, and Terminating Monad Transformers/, by Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman, Amr Sabry (http://www.cs.rutgers.edu/~ccshan/logicprog/ListT-icfp2005.pdf).

Synopsis

Documentation

newtype ListT m a Source #

A monad transformer for performing backtracking computations layered over another monad m

Constructors

ListT 

Fields

  • unListT :: forall r. (a -> m r -> m r) -> m r -> m r
     
Instances
Monad (ListT m) Source # 
Instance details

Methods

(>>=) :: ListT m a -> (a -> ListT m b) -> ListT m b Source #

(>>) :: ListT m a -> ListT m b -> ListT m b Source #

return :: a -> ListT m a Source #

fail :: String -> ListT m a Source #

Functor (ListT f) Source # 
Instance details

Methods

fmap :: (a -> b) -> ListT f a -> ListT f b Source #

(<$) :: a -> ListT f b -> ListT f a Source #

MonadFail (ListT m) Source # 
Instance details

Methods

fail :: String -> ListT m a Source #

Applicative (ListT f) Source # 
Instance details

Methods

pure :: a -> ListT f a Source #

(<*>) :: ListT f (a -> b) -> ListT f a -> ListT f b Source #

liftA2 :: (a -> b -> c) -> ListT f a -> ListT f b -> ListT f c Source #

(*>) :: ListT f a -> ListT f b -> ListT f b Source #

(<*) :: ListT f a -> ListT f b -> ListT f a Source #

Alternative (ListT f) Source # 
Instance details

Methods

empty :: ListT f a Source #

(<|>) :: ListT f a -> ListT f a -> ListT f a Source #

some :: ListT f a -> ListT f [a] Source #

many :: ListT f a -> ListT f [a] Source #

MonadPlus (ListT m) Source # 
Instance details

Methods

mzero :: ListT m a Source #

mplus :: ListT m a -> ListT m a -> ListT m a Source #

runListT :: ListT m a -> (a -> m r -> m r) -> m r -> m r Source #

Runs a ListT computation with the specified initial success and failure continuations.

select :: Monad m => [a] -> ListT m a Source #

fold :: ListT m a -> (a -> m r -> m r) -> m r -> m r Source #