Safe Haskell | None |
---|---|
Language | GHC2021 |
Box.Committer
Description
Committer
wraps a consumer destructor.
"Commitment is an act, not a word." ~ Jean-Paul Sartre
Synopsis
- newtype Committer (m :: Type -> Type) a = Committer {}
- type CoCommitter (m :: Type -> Type) a = Codensity m (Committer m a)
- witherC :: Monad m => (b -> m (Maybe a)) -> Committer m a -> Committer m b
- listC :: forall (m :: Type -> Type) a. Monad m => Committer m a -> Committer m [a]
- push :: forall (m :: Type -> Type) a. Monad m => Committer (StateT (Seq a) m) a
Documentation
newtype Committer (m :: Type -> Type) a Source #
A Committer commit
s values of type a and signals success or otherwise. A sink or 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.
>>>
commit toStdout "I'm committed!"
I'm committed! True
type CoCommitter (m :: Type -> Type) a = Codensity m (Committer m a) Source #
Committer
continuation.
witherC :: Monad m => (b -> m (Maybe a)) -> Committer m a -> Committer m b Source #
A monadic Witherable
>>>
glue (witherC (\x -> pure $ bool Nothing (Just x) (even x)) showStdout) <$|> qList [0..5]
0 2 4