Safe Haskell | None |
---|

This module defines the MonoidNull class and some of its instances.

- class Monoid m => MonoidNull m where
- class MonoidNull m => PositiveMonoid m

# Documentation

class Monoid m => MonoidNull m whereSource

Extension of `Monoid`

that allows testing a value for equality with `mempty`

. The following law must hold:

null x == (x == mempty)

Furthermore, the performance of this method should be constant, *i.e.*, independent of the length of its argument.

MonoidNull Ordering | |

MonoidNull () | |

MonoidNull All | |

MonoidNull Any | |

MonoidNull ByteString | |

MonoidNull ByteString | |

MonoidNull IntSet | |

MonoidNull Text | |

MonoidNull Text | |

MonoidNull ByteStringUTF8 | |

MonoidNull [x] | |

MonoidNull a => MonoidNull (Dual a) | |

(Num a, Eq a) => MonoidNull (Sum a) | |

(Num a, Eq a) => MonoidNull (Product a) | |

MonoidNull (First a) | |

MonoidNull (Last a) | |

Monoid a => MonoidNull (Maybe a) | |

MonoidNull (Seq a) | |

MonoidNull (IntMap v) | |

Ord a => MonoidNull (Set a) | |

MonoidNull (Vector a) | |

MonoidNull (Concat a) | |

(MonoidNull a, MonoidNull b) => MonoidNull (a, b) | |

Ord k => MonoidNull (Map k v) |

class MonoidNull m => PositiveMonoid m Source

Subclass of `Monoid`

for types whose values have no inverse, with the exception of `mempty`

. More formally, the
class instances must satisfy the following law:

null (x <> y) == (null x && null y)

PositiveMonoid Ordering | |

PositiveMonoid () | |

PositiveMonoid All | |

PositiveMonoid Any | |

PositiveMonoid ByteString | |

PositiveMonoid ByteString | |

PositiveMonoid IntSet | |

PositiveMonoid Text | |

PositiveMonoid Text | |

PositiveMonoid ByteStringUTF8 | |

PositiveMonoid [x] | |

PositiveMonoid a => PositiveMonoid (Dual a) | |

PositiveMonoid (First a) | |

PositiveMonoid (Last a) | |

Monoid a => PositiveMonoid (Maybe a) | |

PositiveMonoid (Seq a) | |

PositiveMonoid (IntMap v) | |

Ord a => PositiveMonoid (Set a) | |

PositiveMonoid (Vector a) | |

PositiveMonoid (Concat a) | |

Ord k => PositiveMonoid (Map k v) |