Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- class Monad m => MonadNew m v where
- class (MonadRead m v, Monad m) => MonadLock m v where
- class Monad m => MonadRead m v where
- class Monad m => MonadWrite m v where
- class Monad m => MonadSwap m v where
- class MonadWrite m v => MonadMutate_ m v where
- class (MonadRead m v, MonadMutate_ m v) => MonadMutate m v where
- class MonadFoldMutate m v where
- class MonadMutate_ m v => MonadMutateM_ f m v where
- class (MonadMutate m v, MonadMutateM_ f m v) => MonadMutateM f m v where
- class MonadFoldMutateM m n v where

# Documentation

class Monad m => MonadNew m v where Source #

A type class for containers that can be created and initialized with a single value.

class (MonadRead m v, Monad m) => MonadLock m v where Source #

A type class for at most one element containers.
An attempt to get a value from an empty container or
to put a value into a full container results in a block.
I.e. this is a type class for `MVar`

-like things.

Get a value from a container. Block on empty.
A la `takeMVar`

.

fill :: v a -> a -> m () Source #

Put a value to a container. Block on full.
A la `putMVar`

.

tryHold :: v a -> m (Maybe a) Source #

Get a value from a container. Return `Nothing`

on empty.
A la `tryTakeMVar`

.

tryFill :: v a -> a -> m Bool Source #

Put a value to a container. Return `Nothing`

on full.
A la `tryPutMVar`

.

tryRead :: v a -> m (Maybe a) Source #

Read a value from a container. Return `Nothing`

on empty.
A la `tryReadMVar`

.

Create an empty container.
A la `newEmptyMVar`

.

isEmpty :: v a -> m Bool Source #

Check whether a container is empty.
A la `isEmptyMVar`

.

class Monad m => MonadRead m v where Source #

A type class for containers from which a single value can be read.

class Monad m => MonadWrite m v where Source #

A type class for containers to which a single value can be written.

class Monad m => MonadSwap m v where Source #

A type class for containers for which one value can be replaced with an another (not necessarily at the same position).

class MonadWrite m v => MonadMutate_ m v where Source #

A type class for mutable containers which can be mapped over.

class (MonadRead m v, MonadMutate_ m v) => MonadMutate m v where Source #

A type class for one-element containers which can be mapped and folded over simultaneously. These are basically variables.

class MonadFoldMutate m v where Source #

A type class for mutable containers which can be mapped and folded over simultaneously.

foldMutate :: Monoid b => v a -> (a -> (a, b)) -> m b Source #

class MonadMutate_ m v => MonadMutateM_ f m v where Source #

A type class for mutable containers which can be monadically mapped over.

class (MonadMutate m v, MonadMutateM_ f m v) => MonadMutateM f m v where Source #

A type class for one-element containers which can be monadically mapped and folded over simultaneously. These are basically variables.

class MonadFoldMutateM m n v where Source #

A type class for mutable containers which can be monadically mapped and folded over simultaneously.

foldMutateM :: Monoid b => v a -> (a -> m (a, b)) -> n b Source #