Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Committer m a = Committer {}
- drain :: Applicative m => Committer m a
- mapC :: Monad m => (b -> m (Maybe a)) -> Committer m a -> Committer m b
- premapC :: Applicative m => (Committer m a -> m ()) -> Committer m a -> Committer m a
- postmapC :: Monad m => (Committer m a -> m ()) -> Committer m a -> Committer m a
- stateC :: Monad m => Committer (StateT [a] m) a
- listC :: Monad m => Committer m a -> Committer m [a]
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.
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