zero-0.1.1: Semigroups with absorption

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

Data.Zero

Description

 

Synopsis

Documentation

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:

Annhilation

 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.

newtype Product a Source

Zero under multiplication.

Constructors

Product 

Fields

getProduct :: a
 

Instances

newtype Any Source

Zero under boolean logical or.

Constructors

Any 

Fields

getAny :: Bool
 

newtype All Source

Zero under boolean logical and.

Constructors

All 

Fields

getAll :: Bool
 

success :: a -> Success a Source

A successful value.

failure :: Success a Source

A failure.