-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | basic orders -- -- support for partial orders and other stuffs @package orders @version 0.1.0.0 module Data.PartialOrder class PartialOrder t where pcompare x y = case (lte x y, lte y x) of { (True, True) -> Just EQ (True, False) -> Just LT (False, True) -> Just GT (False, False) -> Nothing } comparable x y = isJust $ pcompare x y lte x y = let c = pcompare x y in c == Just LT || c == Just EQ gte x y = let c = pcompare x y in c == Just GT || c == Just EQ lt x y = pcompare x y == Just LT gt x y = pcompare x y == Just GT eq x y = pcompare x y == Just EQ pcompare :: PartialOrder t => t -> t -> Maybe Ordering comparable :: PartialOrder t => t -> t -> Bool lte :: PartialOrder t => t -> t -> Bool gte :: PartialOrder t => t -> t -> Bool lt :: PartialOrder t => t -> t -> Bool gt :: PartialOrder t => t -> t -> Bool eq :: PartialOrder t => t -> t -> Bool group3 :: (a, b, c) -> ((a, b), c) ungroup3 :: ((a, b), c) -> (a, b, c) group4 :: (a, b, c, d) -> ((a, b), c, d) ungroup4 :: ((a, b), c, d) -> (a, b, c, d) (.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d instance (Ord k, PartialOrder v) => PartialOrder (Map k v) instance Ord a => PartialOrder (Set a) instance (PartialOrder a, PartialOrder b) => PartialOrder (Either a b) instance (PartialOrder a, PartialOrder b, PartialOrder c, PartialOrder d) => PartialOrder (a, b, c, d) instance (PartialOrder a, PartialOrder b, PartialOrder c) => PartialOrder (a, b, c) instance (PartialOrder a, PartialOrder b) => PartialOrder (a, b) instance PartialOrder Integer instance PartialOrder Int instance PartialOrder Bool instance PartialOrder () module Data.Lattice class Lattice a lbot :: Lattice a => a ltop :: Lattice a => a ljoin :: Lattice a => a -> a -> a lmeet :: Lattice a => a -> a -> a lmeets :: Lattice l => [l] -> l ljoins :: Lattice l => [l] -> l instance (Ord k, Lattice v) => Lattice (Map k v) instance Ord a => Lattice (Set a) instance (Lattice a, Lattice b, Lattice c, Lattice d) => Lattice (a, b, c, d) instance (Lattice a, Lattice b, Lattice c) => Lattice (a, b, c) instance (Lattice a, Lattice b) => Lattice (a, b) instance (Lattice a, Lattice b) => Lattice (Either a b) instance Lattice ()