mempty

Identity of mappend

Examples

>>> "Hello world" <> mempty
"Hello world"
>>> mempty <> [1, 2, 3]
[1,2,3]
Identity of mappend
>>> "Hello world" <> mempty
"Hello world"
Identity of mappend
Type-level monoid identity mempty.

Examples

>>> :kind! LT <> MEmpty
LT <> MEmpty :: Ordering
= LT
>>> :kind! MEmpty <> '(EQ, [1, 2])
MEmpty <> '(EQ, [1, 2]) :: (Ordering, [Natural])
= '(EQ, [1, 2])
>>> :kind! '(GT, Just '()) <> MEmpty
'(GT, Just '()) <> MEmpty :: (Ordering, Maybe ())
= '(GT, Just '())
Returns the given value in case of the given predicate is satisfied (is True). Otherwise, it returns mempty.
>>> memptyIfFalse True (Just "Hello")
Just "Hello"

>>> memptyIfFalse False "Doesn't matter"
""
Returns the given value in case of the given predicate is unsatisfied (is False). Otherwise, it returns mempty.
>>> memptyIfTrue True (Just "Hello")
Nothing

>>> memptyIfTrue False "Does matter"
"Does matter"
often we will want to construct a Monoid HashMap from Monoid records
often we will want to construct a Monoid Intmap from Monoid records
Type-level monoid identity mempty. This is the fcf-encoding of MEmpty.
Generically generate a Monoid mempty for any product-like type implementing Generic. It is only defined for product types.
gmappend gmempty a = a = gmappend a gmempty
A guard tree denoting an -XEmptyCase.
This function differs from the original mempty in that it takes an argument. In some cases, you will already have a record of the type you are interested in, and that can be passed an the argument. In other situations where this is not the case, you may need the interpretation function of the argument record to be Const () or Proxy so the you can generate the argument with rpure.