Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- class PEq t => PPartialOrd t where
- class PPartialOrd t => POrd t where
Documentation
class PEq t => PPartialOrd t where Source #
Partial ordering relation.
Laws
#<=
must form a partial order. More precisely:
x #<= x
=
True
(#<=
is reflexive)(x #<= y) #&& (y #<= x)
=
x #== y
(#<=
is anti-symmetric)(x #<= y) #&& (y #<= z)
=
x #<= z
(@#<= is transitive)
Furthermore, #<
must be an equivalent strict partial order to #<=
:
x #<= y
=
(x #< y) #|| (x #== y)
x #< x
=
False
(#<
is irreflexive)x #< y
=
pnot (y #< x)
(#<
is asymmetric)(x #< y) #&& (y #< z)
=
x #< z
(#<
is transitive)
Lastly, if you define #>=
or #>
, ensure that the following also hold:
x #> y
=
y #< x
x #>= y
=
pnot (x #< y)
The default implementations of #>=
and #>
ensure these laws.
Nothing
(#<=) :: Term s t -> Term s t -> Term s PBool infix 4 Source #
(#<) :: Term s t -> Term s t -> Term s PBool infix 4 Source #
(#>=) :: forall (s :: S). Term s t -> Term s t -> Term s PBool infix 4 Source #
@since WIP
(#>) :: forall (s :: S). Term s t -> Term s t -> Term s PBool infix 4 Source #
@since WIP
Instances
class PPartialOrd t => POrd t where Source #
Total ordering relation.
Laws
pmax
and pmin
must form a commutative semiring without identity
elements, where addition also distributes over multiplication. More
precisely:
pmax x y
=
pmax y x
(pmax
is commutative)pmin x y
=
pmin y x
(pmin
is commutative)pmax x (pmax y z)
=
pmax (pmax x y) z
(pmax
is associative)pmin x (pmin y z)
=
pmin (pmin x y) z
(pmin
is associative)pmax x (pmin y z)
=
pmin (pmax x y) (pmax x z)
(pmax
distributes overpmin
)pmin x (pmax y z)
=
pmax (pmin x y) (pmin x z)
(pmin
distributes overpmax
)
Furthermore, the following must hold relative #<
:
pmin x y
=
if (x #< y) then x else y
pmax x y
=
if (x #< y) then y else x
Laws 7 and 8 are also the defaults, as for most types, this is the best you can do.
Nothing
pmax :: forall (s :: S). Term s t -> Term s t -> Term s t Source #
@since WIP
pmin :: forall (s :: S). Term s t -> Term s t -> Term s t Source #
@since WIP