Control.Monad.List.Trans
- Package
- purescript-transformers
- Repository
- purescript/purescript-transformers
This module defines the list monad transformer, ListT
.
#ListT Source
newtype ListT :: (Type -> Type) -> Type -> Type
newtype ListT f a
The 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) => MonadPlus (ListT f)
(MonadEffect m) => MonadEffect (ListT m)
#Step Source
data Step a s
The 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 f a. Applicative f => Int -> ListT f a -> ListT f a
Drop a number of elements from the front of a list.
#dropWhile Source
dropWhile :: forall f a. Applicative f => (a -> Boolean) -> ListT f a -> ListT f a
Drop elements from the front of a list while a predicate holds.
#fromEffect Source
fromEffect :: forall f a. Applicative f => f a -> ListT f a
Lift a computation from the base functor.
#nil Source
nil :: forall f a. Applicative f => ListT f a
The empty list.
#prepend Source
prepend :: forall f a. Applicative f => a -> ListT f a -> ListT f a
Prepend an element to a list.
#prepend' Source
prepend' :: forall f a. Applicative f => a -> Lazy (ListT f a) -> ListT f a
Prepend an element to a lazily-evaluated list.
#runListTRec Source
runListTRec :: forall f a. MonadRec f => ListT f a -> f Unit
Drain a ListT
, running it to completion and discarding all values.
Stack safe: Uses tail call optimization.
#singleton Source
singleton :: forall f a. Applicative f => a -> ListT f a
Create a list with one element.
#take Source
take :: forall f a. Applicative f => Int -> ListT f a -> ListT f a
Take a number of elements from the front of a list.
#takeWhile Source
takeWhile :: forall f a. Applicative f => (a -> Boolean) -> ListT f a -> ListT f a
Take elements from the front of a list while a predicate holds.
#wrapEffect Source
wrapEffect :: forall f a. Functor f => f (ListT f a) -> ListT f a
Lift a computation from the base monad.
#wrapLazy Source
wrapLazy :: forall f a. Applicative f => Lazy (ListT f a) -> ListT f a
Defer evaluation of a list.
Re-exports from Control.Monad.Trans.Class
#MonadTrans Source
class MonadTrans :: ((Type -> Type) -> Type -> Type) -> Constraint
class MonadTrans t where
The 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 a
lift (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. Identity. 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