-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type-level Ord compatibility layer -- -- In base-4.16.0.0, an open type family Compare was -- added as a type-level analog of Ord. This package provides a -- compatible interface on earlier versions of base, and -- re-exports the canonical one with later versions. @package type-compare @version 0.1.0 -- | Type-level Ord. -- -- On recent versions of base, this just re-exports things from -- Data.Type.Ord. On older versions, it provides its own -- implementation, moved from older versions of numeric-kinds. module Kinds.Ord -- | Type-level Ord "kindclass". -- -- Note this has an invisible dependent k parameter that makes -- the textually-identical instances for different kinds actually -- different. Neat! type family Compare (x :: k) (y :: k) :: Ordering type x =? y = CompareCond x y False True True infix 4 >=? type x >? y = CompareCond x y False False True infix 4 >? type x < y = Proven (x = y = Proven (x >=? y) infix 4 >= type x > y = Proven (x >? y) infix 4 > type Max x y = CompareCond x y y y x type Min x y = CompareCond x y x x y -- | Turns a type-level Bool into a Constraint that it's -- True. type Proven b = b ~ 'True -- | Type-level eliminator for Ordering. -- -- OrdCond o lt eq gt selects from among lt, -- eq, and gt according to o. type family OrdCond (o :: Ordering) (lt :: k) (eq :: k) (gt :: k) :: k -- | CompareCond x y lt eq gt is lt if x is less -- than y, and so on. type CompareCond x y lt eq gt = OrdCond (Compare x y) lt eq gt