Safe Haskell | None |
---|---|
Language | GHC2021 |
Rerefined.Predicate.Relational
Documentation
Relational operator.
Constructor order is arbitrary due to NEQ
, which obstructs ordering in a
meaningful way.
Note that these operators may be defined by combining Ordering
s in certain
ways: for example
could be LT
OR EQ
LTE
,
could be LT
OR GT
NEQ
.
This is convenient for user intuition, permitting the use of e.g. LT
as a
relational operator directly. However, it complicates type-level work, as now we
can't restrict relational operators to a given kind, and we have to handle
non-standard orderings like
.GT
OR LT
data CompareValue (op :: RelOp) (sign :: Sign) (n :: Natural) Source #
Instances
Predicate (CompareValue op sign n :: Type) Source # | Precedence of 4 (matching base relational operators e.g. |
Defined in Rerefined.Predicate.Relational.Value | |
(KnownNat n, Num a, Ord a, ReifyRelOp op, ReifySignedNat sign n, KnownPredicateName (CompareValue op sign n)) => Refine (CompareValue op sign n :: Type) a Source # | |
Defined in Rerefined.Predicate.Relational.Value Methods validate :: Proxy# (CompareValue op sign n) -> a -> Maybe RefineFailure Source # | |
type PredicateName d (CompareValue op sign n :: Type) Source # | |
Defined in Rerefined.Predicate.Relational.Value type PredicateName d (CompareValue op sign n :: Type) = ShowParen (d > 4) (((("Value " ++ ShowRelOp op) ++ ShowChar ' ') ++ ShowSign sign) ++ ShowNatDec n) |
data CompareLength (op :: RelOp) (n :: Natural) Source #
Instances
type family WidenRelOp (op :: RelOp) (n :: Natural) (m :: Natural) :: Bool where ... Source #
Equations
WidenRelOp op n n = 'True | |
WidenRelOp 'RelOpLT n m = OrdCond (CmpNat n m) 'True 'True 'False | |
WidenRelOp 'RelOpLTE n m = OrdCond (CmpNat n m) 'True 'True 'False | |
WidenRelOp 'RelOpGTE n m = OrdCond (CmpNat n m) 'False 'True 'True | |
WidenRelOp 'RelOpGT n m = OrdCond (CmpNat n m) 'False 'True 'True | |
WidenRelOp op n m = 'False |