monoid-extras-0.3.3.3: Various extra monoid-related definitions and utilities

Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellSafe-Inferred

Data.Monoid.Inf

Contents

Description

Make semigroup under min or max into monoids by adjoining an element corresponding to infinity (positive or negative, respectively). These types are similar to Option (Min a) and Option (Max a) respectively, except that the Ord instance matches the Monoid instance.

Synopsis

Documentation

data Inf p a Source

Constructors

Infinity 
Finite a 

Instances

Functor (Inf p) 
Foldable (Inf p) 
Traversable (Inf p) 
Eq a => Eq (Inf p a) 
Ord a => Ord (Inf Neg a) 
Ord a => Ord (Inf Pos a) 
Read a => Read (Inf p a) 
Show a => Show (Inf p a) 
Ord a => Monoid (Inf Neg a) 
Ord a => Monoid (Inf Pos a) 
Ord a => Semigroup (Inf Neg a) 
Ord a => Semigroup (Inf Pos a) 

data Pos Source

Instances

Ord a => Ord (Inf Pos a) 
Ord a => Monoid (Inf Pos a) 
Ord a => Semigroup (Inf Pos a) 

data Neg Source

Instances

Ord a => Ord (Inf Neg a) 
Ord a => Monoid (Inf Neg a) 
Ord a => Semigroup (Inf Neg a) 

type PosInf a = Inf Pos aSource

type NegInf a = Inf Neg aSource

minimum :: Ord a => [a] -> PosInf aSource

maximum :: Ord a => [a] -> NegInf aSource

Type-restricted constructors