HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleChasingBottoms-1.3.1.16Haskell2010

Test.ChasingBottoms.SemanticOrd

Generic semantic equality and order. The semantic order referred to is that of a typical CPO for Haskell types, where e.g. (True, bottom) <=! (True, False), but where (True, True) and (True, False) are incomparable.

The implementation is based on isBottom, and has the same limitations. Note that non-bottom functions are not handled by any of the functions described below.

One could imagine using QuickCheck for testing equality of functions, but I have not managed to tweak the type system so that it can be done transparently.

  • 1 type
  • 2 classes
  • 1 value
datadata Tweak
#

The behaviour of some of the functions below can be tweaked.

Constructors

Instances3Eq, Ord, Show
  • Eq TweakDefined in ChasingBottoms-1.3.1.16 · Test.ChasingBottoms.SemanticOrd
  • Ord TweakDefined in ChasingBottoms-1.3.1.16 · Test.ChasingBottoms.SemanticOrd
  • Show TweakDefined in ChasingBottoms-1.3.1.16 · Test.ChasingBottoms.SemanticOrd
classclass SemanticEq a => SemanticOrd a where
#

SemanticOrd contains methods for testing whether two terms are related according to the semantic domain ordering.

Methods

  • (<!) :: a -> a -> Boolinfix 4
  • (<=!) :: a -> a -> Boolinfix 4
  • (>=!) :: a -> a -> Boolinfix 4
  • (>!) :: a -> a -> Boolinfix 4
  • semanticCompare :: Tweak -> a -> a -> Maybe Ordering

    semanticCompare tweak x y returns Nothing if x and y are incomparable, and Just o otherwise, where o :: Ordering represents the relation between x and y.

  • (\/!) :: a -> a -> Maybe ainfix 5
  • (/\!) :: a -> a -> ainfixl 5
  • semanticJoin :: Tweak -> a -> a -> Maybe a
  • semanticMeet :: Tweak -> a -> a -> a

    x \/! y and x /\! y compute the least upper and greatest lower bounds, respectively, of x and y in the semantical domain ordering. Note that the least upper bound may not always exist. This functionality was implemented just because it was possible (and to provide analogues of max and min in the Ord class). If anyone finds any use for it, please let me know.

Instances1SemanticOrd
  • Data a => SemanticOrd aDefined in ChasingBottoms-1.3.1.16 · Test.ChasingBottoms.SemanticOrd