extra-1.7.16: Extra functions I use.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Monoid.Extra

Contents

- Extra operations

Description

Extra functions for working with monoids.

Synopsis

- module Data.Monoid
- mwhen :: Monoid a => Bool -> a -> a

# Documentation

module Data.Monoid

# Extra operations

mwhen :: Monoid a => Bool -> a -> a Source #

Like `when`, but operating on a `Monoid`. If the first argument is `True` returns the second, otherwise returns `mempty`.

    mwhen True  "test" == "test"
    mwhen False "test" == ""