Proposal: Add Data.Monoid.mwhen :: Monoid m => Bool -> m -> m

Henning Thielemann lemming at henning-thielemann.de
Thu Apr 11 09:49:30 UTC 2019


On Wed, 10 Apr 2019, James Ashwell wrote:

> This would mimic the behaviour of Control.Monad.when for monoids rather than applicatives.
> 
> mwhen :: Monoid m => Bool -> m -> m
> mwhen b a
> | b         = a
> | otherwise = mempty


https://hackage.haskell.org/package/utility-ht-0.0.14/docs/Data-Monoid-HT.html#v:when


More information about the Libraries mailing list