box-0.7.0: boxes
Safe HaskellSafe-Inferred
LanguageHaskell2010

Box.Committer

Description

Synopsis

Documentation

newtype Committer m a Source #

a Committer a "commits" values of type a. A Sink and a Consumer are some other metaphors for this.

A Committer absorbs the value being committed; the value disappears into the opaque thing that is a Committer from the pov of usage.

Constructors

Committer 

Fields

Instances

Instances details
Contravariant (Committer m) Source # 
Instance details

Defined in Box.Committer

Methods

contramap :: (a -> b) -> Committer m b -> Committer m a #

(>$) :: b -> Committer m b -> Committer m a #

Applicative m => Divisible (Committer m) Source # 
Instance details

Defined in Box.Committer

Methods

divide :: (a -> (b, c)) -> Committer m b -> Committer m c -> Committer m a #

conquer :: Committer m a #

Applicative m => Decidable (Committer m) Source # 
Instance details

Defined in Box.Committer

Methods

lose :: (a -> Void) -> Committer m a #

choose :: (a -> Either b c) -> Committer m b -> Committer m c -> Committer m a #

MFunctor Committer Source # 
Instance details

Defined in Box.Committer

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> Committer m b -> Committer n b #

Applicative m => Semigroup (Committer m a) Source # 
Instance details

Defined in Box.Committer

Methods

(<>) :: Committer m a -> Committer m a -> Committer m a #

sconcat :: NonEmpty (Committer m a) -> Committer m a #

stimes :: Integral b => b -> Committer m a -> Committer m a #

Applicative m => Monoid (Committer m a) Source # 
Instance details

Defined in Box.Committer

Methods

mempty :: Committer m a #

mappend :: Committer m a -> Committer m a -> Committer m a #

mconcat :: [Committer m a] -> Committer m a #

drain :: Applicative m => Committer m a Source #

Do nothing with values that are committed.

This is useful for keeping the commit end of a box or pipeline open.

mapC :: Monad m => (b -> m (Maybe a)) -> Committer m a -> Committer m b Source #

This is a contramapMaybe, if such a thing existed, as the contravariant version of a mapMaybe. See witherable

premapC :: Applicative m => (Committer m a -> m ()) -> Committer m a -> Committer m a Source #

adds a monadic action to the committer

postmapC :: Monad m => (Committer m a -> m ()) -> Committer m a -> Committer m a Source #

adds a post-commit monadic action to the committer

stateC :: Monad m => Committer (StateT (Seq a) m) a Source #

commit to a StateT Seq.

Seq is used because only a finite number of commits are expected and because snoc'ing is cool.

listC :: Monad m => Committer m a -> Committer m [a] Source #

list committer