ghc-8.2.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 # 

Methods

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

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

return :: a -> ListT m a #

fail :: String -> ListT m a #

Functor (ListT f) Source # 

Methods

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

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

Applicative (ListT f) Source # 

Methods

pure :: a -> ListT f a #

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

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

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

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

Alternative (ListT f) Source # 

Methods

empty :: ListT f a #

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

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

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

MonadPlus (ListT m) Source # 

Methods

mzero :: ListT m a #

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

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 #