Control.Monad.List.Trans
- Package
- purescript-transformers
- Repository
- purescript/purescript-transformers
This module defines the list monad transformer, ListT.
#ListT Source
newtype ListT f aThe list monad transformer.
This monad transformer extends the base monad with non-determinism. That is, the transformed monad supports the same effects as the base monad but with multiple return values.
Constructors
Instances
Newtype (ListT f a) _(Applicative f) => Semigroup (ListT f a)(Applicative f) => Monoid (ListT f a)(Functor f) => Functor (ListT f)(Monad f) => Unfoldable (ListT f)(Monad f) => Unfoldable1 (ListT f)(Monad f) => Apply (ListT f)(Monad f) => Applicative (ListT f)(Monad f) => Bind (ListT f)(Monad f) => Monad (ListT f)MonadTrans ListT(Applicative f) => Alt (ListT f)(Monad f) => Plus (ListT f)(Monad f) => Alternative (ListT f)(Monad f) => MonadZero (ListT f)(Monad f) => MonadPlus (ListT f)(MonadEffect m) => MonadEffect (ListT m)
#Step Source
data Step a sThe result of a single step in a ListT computation. Either:
- Computation has finished (
Done), or - A result has been returned, along with the next part of the computation (
Yield).
The Skip constructor allows us to avoid traversing lists during certain operations.
Constructors
#drop Source
drop :: forall a f. Applicative f => Int -> ListT f a -> ListT f aDrop a number of elements from the front of a list.
#dropWhile Source
dropWhile :: forall a f. Applicative f => (a -> Boolean) -> ListT f a -> ListT f aDrop elements from the front of a list while a predicate holds.
#fromEffect Source
fromEffect :: forall a f. Applicative f => f a -> ListT f aLift a computation from the base functor.
#nil Source
nil :: forall a f. Applicative f => ListT f aThe empty list.
#prepend Source
prepend :: forall a f. Applicative f => a -> ListT f a -> ListT f aPrepend an element to a list.
#prepend' Source
prepend' :: forall a f. Applicative f => a -> Lazy (ListT f a) -> ListT f aPrepend an element to a lazily-evaluated list.
#runListTRec Source
runListTRec :: forall a f. MonadRec f => ListT f a -> f UnitDrain a ListT, running it to completion and discarding all values.
Stack safe: Uses tail call optimization.
#singleton Source
singleton :: forall a f. Applicative f => a -> ListT f aCreate a list with one element.
#take Source
take :: forall a f. Applicative f => Int -> ListT f a -> ListT f aTake a number of elements from the front of a list.
#takeWhile Source
takeWhile :: forall a f. Applicative f => (a -> Boolean) -> ListT f a -> ListT f aTake elements from the front of a list while a predicate holds.
#wrapEffect Source
wrapEffect :: forall a f. Functor f => f (ListT f a) -> ListT f aLift a computation from the base monad.
#wrapLazy Source
wrapLazy :: forall a f. Applicative f => Lazy (ListT f a) -> ListT f aDefer evaluation of a list.
Re-exports from Control.Monad.Trans.Class
#MonadTrans Source
class MonadTrans t whereThe MonadTrans type class represents monad transformers.
A monad transformer is a type constructor of kind (* -> *) -> * -> *, which
takes a Monad as its first argument, and returns another Monad.
This allows us to add additional effects to an existing monad. By iterating this process, we create monad transformer stacks, which contain all of the effects required for a particular computation.
The laws state that lift is a Monad morphism.
Laws:
lift (pure a) = pure alift (do { x <- m ; y }) = do { x <- lift m ; lift y }
Members
- Modules
- Control.
Comonad. Env - Control.
Comonad. Env. Class - Control.
Comonad. Env. Trans - Control.
Comonad. Store - Control.
Comonad. Store. Class - Control.
Comonad. Store. Trans - Control.
Comonad. Traced - Control.
Comonad. Traced. Class - Control.
Comonad. Traced. Trans - Control.
Comonad. Trans. Class - Control.
Monad. Cont - Control.
Monad. Cont. Class - Control.
Monad. Cont. Trans - Control.
Monad. Error. Class - Control.
Monad. Except - Control.
Monad. Except. Trans - Control.
Monad. List. Trans - Control.
Monad. Maybe. Trans - Control.
Monad. RWS - Control.
Monad. RWS. Trans - Control.
Monad. Reader - Control.
Monad. Reader. Class - Control.
Monad. Reader. Trans - Control.
Monad. State - Control.
Monad. State. Class - Control.
Monad. State. Trans - Control.
Monad. Trans. Class - Control.
Monad. Writer - Control.
Monad. Writer. Class - Control.
Monad. Writer. Trans