logict-sequence-0.1.0.0: A backtracking logic-programming monad with asymptotic improvements to msplit
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Logic.Sequence

Synopsis

Documentation

newtype SeqT m a Source #

Constructors

SeqT (Queue (m (Maybe (a, SeqT m a)))) 

Instances

Instances details
MonadTrans SeqT Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

lift :: Monad m => m a -> SeqT m a #

Monad m => Monad (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

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

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

return :: a -> SeqT m a #

Monad m => Functor (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

fmap :: (a -> b) -> SeqT m a -> SeqT m b #

(<$) :: a -> SeqT m b -> SeqT m a #

Monad m => MonadFail (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

fail :: String -> SeqT m a #

Monad m => Applicative (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

pure :: a -> SeqT m a #

(<*>) :: SeqT m (a -> b) -> SeqT m a -> SeqT m b #

liftA2 :: (a -> b -> c) -> SeqT m a -> SeqT m b -> SeqT m c #

(*>) :: SeqT m a -> SeqT m b -> SeqT m b #

(<*) :: SeqT m a -> SeqT m b -> SeqT m a #

MonadIO m => MonadIO (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

liftIO :: IO a -> SeqT m a #

Monad m => Alternative (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

empty :: SeqT m a #

(<|>) :: SeqT m a -> SeqT m a -> SeqT m a #

some :: SeqT m a -> SeqT m [a] #

many :: SeqT m a -> SeqT m [a] #

Monad m => MonadPlus (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

mzero :: SeqT m a #

mplus :: SeqT m a -> SeqT m a -> SeqT m a #

Monad m => MonadLogic (SeqT m) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

msplit :: SeqT m a -> SeqT m (Maybe (a, SeqT m a)) #

interleave :: SeqT m a -> SeqT m a -> SeqT m a #

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

ifte :: SeqT m a -> (a -> SeqT m b) -> SeqT m b -> SeqT m b #

once :: SeqT m a -> SeqT m a #

lnot :: SeqT m a -> SeqT m () #

Monad m => Semigroup (SeqT m a) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

(<>) :: SeqT m a -> SeqT m a -> SeqT m a #

sconcat :: NonEmpty (SeqT m a) -> SeqT m a #

stimes :: Integral b => b -> SeqT m a -> SeqT m a #

Monad m => Monoid (SeqT m a) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

mempty :: SeqT m a #

mappend :: SeqT m a -> SeqT m a -> SeqT m a #

mconcat :: [SeqT m a] -> SeqT m a #

type Seq a = SeqT Identity a Source #

type Queue = MSeq FastTCQueue Source #

Based on the LogicT improvements in the paper, Reflection without Remorse. Code is based on the code provided in: https://github.com/atzeus/reflectionwithoutremorse

Note: that code is provided under an MIT license, so we use that as well.

newtype MSeq s a Source #

Constructors

MSeq 

Fields

Instances

Instances details
TASequence s => Functor (MSeq s) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

fmap :: (a -> b) -> MSeq s a -> MSeq s b #

(<$) :: a -> MSeq s b -> MSeq s a #

TASequence s => Foldable (MSeq s) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

fold :: Monoid m => MSeq s m -> m #

foldMap :: Monoid m => (a -> m) -> MSeq s a -> m #

foldMap' :: Monoid m => (a -> m) -> MSeq s a -> m #

foldr :: (a -> b -> b) -> b -> MSeq s a -> b #

foldr' :: (a -> b -> b) -> b -> MSeq s a -> b #

foldl :: (b -> a -> b) -> b -> MSeq s a -> b #

foldl' :: (b -> a -> b) -> b -> MSeq s a -> b #

foldr1 :: (a -> a -> a) -> MSeq s a -> a #

foldl1 :: (a -> a -> a) -> MSeq s a -> a #

toList :: MSeq s a -> [a] #

null :: MSeq s a -> Bool #

length :: MSeq s a -> Int #

elem :: Eq a => a -> MSeq s a -> Bool #

maximum :: Ord a => MSeq s a -> a #

minimum :: Ord a => MSeq s a -> a #

sum :: Num a => MSeq s a -> a #

product :: Num a => MSeq s a -> a #

TASequence s => Traversable (MSeq s) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

traverse :: Applicative f => (a -> f b) -> MSeq s a -> f (MSeq s b) #

sequenceA :: Applicative f => MSeq s (f a) -> f (MSeq s a) #

mapM :: Monad m => (a -> m b) -> MSeq s a -> m (MSeq s b) #

sequence :: Monad m => MSeq s (m a) -> m (MSeq s a) #

TASequence s => Sequence (MSeq s) Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

empty :: MSeq s c #

singleton :: c -> MSeq s c #

(><) :: MSeq s c -> MSeq s c -> MSeq s c #

viewl :: MSeq s c -> ViewL (MSeq s) c #

viewr :: MSeq s c -> ViewR (MSeq s) c #

(|>) :: MSeq s c -> c -> MSeq s c #

(<|) :: c -> MSeq s c -> MSeq s c #

data AsUnitLoop a b c where Source #

Constructors

UL :: !a -> AsUnitLoop a () () 

observeAllT :: Monad m => SeqT m a -> m [a] Source #

observeAll :: Seq a -> [a] Source #

observeT :: MonadFail m => SeqT m a -> m a Source #

observe :: Seq a -> a Source #

observeMaybeT :: Monad m => SeqT m (Maybe a) -> m (Maybe a) Source #

class MonadTrans (t :: (Type -> Type) -> Type -> Type) where #

The class of monad transformers. Instances should satisfy the following laws, which state that lift is a monad transformation:

Methods

lift :: Monad m => m a -> t m a #

Lift a computation from the argument monad to the constructed monad.

Instances

Instances details
MonadTrans SeqT Source # 
Instance details

Defined in Control.Monad.Logic.Sequence

Methods

lift :: Monad m => m a -> SeqT m a #

MonadTrans (ErrorT e) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

lift :: Monad m => m a -> ErrorT e m a #