-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A definition of Posets. -- -- A library defining the notion of Poset. @package ordered @version 0.1 -- | 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. module Data.Poset -- | 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. class Eq a => Poset a posetCmp :: Poset a => a -> a -> PosetOrd (<==>) :: Poset a => a -> a -> Bool () :: Poset a => a -> a -> Bool leq :: Poset a => a -> a -> Bool geq :: Poset a => a -> a -> Bool lt :: Poset a => a -> a -> Bool gt :: Poset a => a -> a -> Bool -- | Are two elements of the underlying comparabale or not; if they are, -- then Ordering tell the relation between them. data PosetOrd Comp :: Ordering -> PosetOrd NComp :: PosetOrd -- | Apply a function to values before comparing. comparing :: Poset b => (a -> b) -> a -> a -> PosetOrd instance Poset a => Poset [a] instance Poset a => Poset (Maybe a)