| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Control.Monad.Logic.Sequence
Synopsis
- data SeqT m a where
- type Seq = SeqT Identity
- pattern MkSeq :: View a -> Seq a
- getSeq :: Seq a -> View a
- data ViewT m a
- type View = ViewT Identity
- viewT :: b -> (a -> SeqT m a -> b) -> ViewT m a -> b
- view :: b -> (a -> Seq a -> b) -> View a -> b
- toViewT :: Monad m => SeqT m a -> m (ViewT m a)
- toView :: forall a. Seq a -> View a
- fromViewT :: m (ViewT m a) -> SeqT m a
- fromView :: forall a. View a -> Seq a
- cons :: Monad m => a -> SeqT m a -> SeqT m a
- consM :: Monad m => m a -> SeqT m a -> SeqT m a
- choose :: (Foldable t, Monad m) => t a -> SeqT m a
- chooseM :: (Foldable t, Monad m) => t (m a) -> SeqT m a
- observeAllT :: Monad m => SeqT m a -> m [a]
- observeAll :: Seq a -> [a]
- observeManyT :: Monad m => Int -> SeqT m a -> m [a]
- observeMany :: Int -> Seq a -> [a]
- observeT :: Monad m => SeqT m a -> m (Maybe a)
- observe :: Seq a -> Maybe a
- module Control.Monad
- module Control.Monad.Trans
Documentation
An asymptotically efficient logic monad transformer. It is generally best to think of this as being defined
newtype SeqT m a =MkSeqT{getSeqT:: m (ViewTm a) }
Using the MkSeqT pattern synonym with getSeqT, you can (almost) pretend
it's really defined this way! However, the real implementation is different,
so as to be more efficient in the face of deeply left-associated <|> or
mplus applications.
Instances
type Seq = SeqT Identity Source #
A specialization of SeqT to the Identity monad. You can
imagine that this is defined
newtype Seq a = MkSeq { getSeq :: ViewT Identity a }
Using the MkSeq pattern synonym with getSeq, you can pretend it's
really defined this way! However, the real implementation is different,
so as to be more efficient in the face of deeply left-associated <|>
or mplus applications.
A view of the front end of a SeqT.
Instances
choose :: (Foldable t, Monad m) => t a -> SeqT m a Source #
choose = foldr (a s -> pure a | s) empty
choose :: Monad m => [a] -> SeqT m a
chooseM :: (Foldable t, Monad m) => t (m a) -> SeqT m a Source #
chooseM = foldr (ma s -> lift ma | s) empty
chooseM :: Monad m => [m a] -> SeqT m a
observeAllT :: Monad m => SeqT m a -> m [a] Source #
Perform all the actions in a SeqT and gather the results.
observeAll :: Seq a -> [a] Source #
Get all the results in a Seq.
observeManyT :: Monad m => Int -> SeqT m a -> m [a] Source #
observeManyT n s performs actions in s until it produces
n results or terminates. All the gathered results are returned.
module Control.Monad
module Control.Monad.Trans