monoid-extras-0.3.0.0: 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

Eq a => Eq (Inf p a) 
Read a => Read (Inf p a) 
Show a => Show (Inf p 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