zero-0.1.4: Semigroups with absorption

Copyright(C) 2015 Dimitri Sabadie
LicenseBSD3
MaintainerDimitri Sabadie <dimitri.sabadie@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Zero

Contents

Description

 

Synopsis

Semigroups with absorbing element

class Semigroup a => Zero a where Source

Semigroup with a zero element. It’s important to understand that the standard Semigroup types – i.e. Maybe and so on – are already biased, because they’re Monoids. That’s why you’ll find a few Zero instances.

Should satisfies the following laws:

Annihilation

 a <> zero = zero <> a = zero

Associativity

 a <> b <> c = (a <> b) <> c = a <> (b <> c)

Minimal complete definition

zero

Methods

zero :: a Source

The zero element.

zconcat :: [a] -> a Source

Concat all the elements according to (<>) and zero.

Num wrappers

newtype Product a :: * -> *

Monoid under multiplication.

Constructors

Product 

Fields

getProduct :: a
 

Instances

Generic1 Product 
Bounded a => Bounded (Product a) 
Eq a => Eq (Product a) 
Num a => Num (Product a) 
Ord a => Ord (Product a) 
Read a => Read (Product a) 
Show a => Show (Product a) 
Generic (Product a) 
Num a => Monoid (Product a) 
Num a => Semigroup (Product a) 
Num a => Zero (Product a) Source 
type Rep1 Product = D1 D1Product (C1 C1_0Product (S1 S1_0_0Product Par1)) 
type Rep (Product a) = D1 D1Product (C1 C1_0Product (S1 S1_0_0Product (Rec0 a))) 

Boolean wrappers

newtype Any :: *

Boolean monoid under disjunction (||).

Constructors

Any 

Fields

getAny :: Bool
 

Instances

Bounded Any 
Eq Any 
Ord Any 
Read Any 
Show Any 
Generic Any 
Monoid Any 
Semigroup Any 
Zero Any Source 
type Rep Any = D1 D1Any (C1 C1_0Any (S1 S1_0_0Any (Rec0 Bool))) 

newtype All :: *

Boolean monoid under conjunction (&&).

Constructors

All 

Fields

getAll :: Bool
 

Instances

Bounded All 
Eq All 
Ord All 
Read All 
Show All 
Generic All 
Monoid All 
Semigroup All 
Zero All Source 
type Rep All = D1 D1All (C1 C1_0All (S1 S1_0_0All (Rec0 Bool))) 

Maybe wrappers

success :: a -> Success a Source

A successful value.

failure :: Success a Source

A failure.