explicit-sharing-0.4.0: Explicit Sharing of Monadic Effects

Data.Monadic.List

Synopsis

Documentation

data List m a Source

Data type for lists where both the head and tail are monadic.

Constructors

Nil 
Cons (m a) (m (List m a)) 

Instances

(Monad m, Trans m a b) => Trans m [a] (List m b)

This instance enables the function Control.Monad.Sharing.eval | to transform ordinary Haskell lists into nested monadic lists.

(Monad m, Trans m a b) => Trans m (List m a) [b]

This instance enables the function Control.Monad.Sharing.eval | to transform nested monadic lists into ordinary Haskell lists.

(Monad m, Trans m a b) => Trans m (List m a) (List m b)

This instance allows to use nested monadic lists as argument to | the Control.Monad.Sharing.share combinator.

nil :: Monad m => m (List m a)Source

The empty monadic list.

cons :: Monad m => m a -> m (List m a) -> m (List m a)Source

Constructs a non-empty monadic list.

isEmpty :: Monad m => m (List m a) -> m BoolSource

Checks if monadic list is empty.

first :: MonadPlus m => m (List m a) -> m aSource

Yields the head of a monadic list. Relies on MonadPlus instance | to provide a failing implementation of fail.

rest :: MonadPlus m => m (List m a) -> m (List m a)Source

Yields the tail of a monadic list. Relies on MonadPlus instance | to provide a failing implementation of fail.