annihilator-0.1.0.0: Semigroups with annihilators and utility functions

Safe HaskellSafe
LanguageHaskell2010

Control.Annihilator

Description

A class for Annihilators, which define a binary function >|> that follows the mathematical properties of: absorbing element, associativity, and commutativity.

Synopsis

Documentation

class Annihilator a where Source

Annihilators are semigroups with annihilators, i.e. the following laws should hold:

ann >|> b = ann
a >|> ann = ann
a >|> b = b

Methods

ann :: a Source

Annihilating element of >|>.

(>|>) :: a -> a -> a Source

Annihilating operator, returns the rightmost element if no annihilators ann are present.

(<|<) :: Annihilator a => a -> a -> a Source

Flipped version of >|>.

aconcat :: (Annihilator a, Foldable t) => t a -> a Source

Annihilating concatenation.

amappend :: (Annihilator a, Monoid a) => a -> a -> a Source

Monadic append with the annihilating operator guarding each argument.

amconcat :: (Annihilator a, Monoid a, Foldable t) => t a -> a Source

Monadic concatenation with the annihilating operator guarding each argument.

avoid :: Annihilator a => a -> a Source

Discard the argument and return ann.