Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A class for Annihilators, which define a binary function >|>
that follows
the mathematical properties of: absorbing element, associativity, and
commutativity.
- class Annihilator a where
- (<|<) :: Annihilator a => a -> a -> a
- aconcat :: (Annihilator a, Foldable t) => t a -> a
- amappend :: (Annihilator a, Monoid a) => a -> a -> a
- amconcat :: (Annihilator a, Monoid a, Foldable t) => t a -> a
- avoid :: Annihilator a => a -> a
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
Annihilating element of >|>
.
Annihilating operator, returns the rightmost element if no
annihilators ann
are present.
Annihilator () Source | |
Annihilator [a] Source | |
Annihilator (Maybe a) Source | |
(Annihilator a, Annihilator b) => Annihilator (a, b) Source |
(<|<) :: 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
.