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

Copyright(c) 2012-2015 diagrams-core team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellSafe
LanguageHaskell2010

Data.Monoid.Inf

Contents

Description

Make semigroups 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

Constructors

Infinity 
Finite a 

Instances

Functor (Inf p) 
Foldable (Inf p) 
Traversable (Inf p) 
Eq a => Eq (Inf p a) 
(Data p, Data a) => Data (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

Instances

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

data Neg

Instances

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

type PosInf a = Inf Pos a

type NegInf a = Inf Neg a

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

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

Type-restricted constructors

posFinite :: a -> PosInf a

negFinite :: a -> NegInf a