rerefined-0.7.0: Refinement types, again
Safe HaskellNone
LanguageGHC2021

Rerefined.Predicate.Relational.Value

Synopsis

Documentation

data CompareValue (op :: RelOp) (sign :: Sign) (n :: Natural) Source #

Compare value to a type-level Natural using the given RelOp.

Instances

Instances details
Predicate (CompareValue op sign n :: Type) Source #

Precedence of 4 (matching base relational operators e.g. >=).

Instance details

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 # 
Instance details

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 # 
Instance details

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 Sign Source #

Constructors

Pos 
Neg 

type family ShowSign (sign :: Sign) :: Symbol where ... Source #

Equations

ShowSign 'Pos = "" 
ShowSign 'Neg = "-" 

class ReifySignedNat (sign :: Sign) (n :: Natural) where Source #

Methods

reifySignedNat :: (Num a, KnownNat n) => a Source #

Instances

Instances details
ReifySignedNat 'Neg n Source # 
Instance details

Defined in Rerefined.Predicate.Relational.Value

Methods

reifySignedNat :: (Num a, KnownNat n) => a Source #

ReifySignedNat 'Pos n Source # 
Instance details

Defined in Rerefined.Predicate.Relational.Value

Methods

reifySignedNat :: (Num a, KnownNat n) => a Source #