backend-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Control.Monad.CollectionState

Synopsis

Documentation

data CollectionState k v a Source #

A State monad that wraps a map that can only be added ("collected") to.

Instances

Instances details
Applicative (CollectionState k v) Source # 
Instance details

Defined in Control.Monad.CollectionState

Methods

pure :: a -> CollectionState k v a #

(<*>) :: CollectionState k v (a -> b) -> CollectionState k v a -> CollectionState k v b #

liftA2 :: (a -> b -> c) -> CollectionState k v a -> CollectionState k v b -> CollectionState k v c #

(*>) :: CollectionState k v a -> CollectionState k v b -> CollectionState k v b #

(<*) :: CollectionState k v a -> CollectionState k v b -> CollectionState k v a #

Functor (CollectionState k v) Source # 
Instance details

Defined in Control.Monad.CollectionState

Methods

fmap :: (a -> b) -> CollectionState k v a -> CollectionState k v b #

(<$) :: a -> CollectionState k v b -> CollectionState k v a #

Monad (CollectionState k v) Source # 
Instance details

Defined in Control.Monad.CollectionState

Methods

(>>=) :: CollectionState k v a -> (a -> CollectionState k v b) -> CollectionState k v b #

(>>) :: CollectionState k v a -> CollectionState k v b -> CollectionState k v b #

return :: a -> CollectionState k v a #

collect :: Ord k => k -> CollectionState k v v -> CollectionState k v () Source #

Add an entry to the collection iff the key is not yet in the collection. The argument state transformation, which returns a value, is only run if the value is to be added.