ordered-0.1: A definition of Posets.

Data.Poset

Description

Partially ordered data types. The standard Ord class is for total orders and therefore not suitable for floating point. However, we can still define meaningful max and sort functions for these types.

We define a PosetOrd class which extends Ord by adding a NComp constructor representing that two elements are incomparable.

Synopsis

Documentation

class Eq a => Poset a whereSource

Class for partially ordered data types. Instances should satisfy the following laws for all values a, b and c:

But note that the floating point instances don't satisfy the first rule.

Minimal definition: posetCmp or leq.

Methods

posetCmp :: a -> a -> PosetOrdSource

(<==>) :: a -> a -> BoolSource

Is comparable to.

(</=>) :: a -> a -> BoolSource

Is not comparable to.

leq :: a -> a -> BoolSource

Less than or equal.

geq :: a -> a -> BoolSource

Greater than or equal.

lt :: a -> a -> BoolSource

Strict less than.

gt :: a -> a -> BoolSource

Strict greater than.

data PosetOrd Source

Are two elements of the underlying comparabale or not; if they are, then Ordering tell the relation between them.

Constructors

Comp Ordering 
NComp 

comparing :: Poset b => (a -> b) -> a -> a -> PosetOrdSource

Apply a function to values before comparing.