rerefined-0.1.0: Refinement types, again
Safe HaskellSafe-Inferred
LanguageGHC2021

Rerefined.Predicate.Relational

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
(Typeable op, Typeable sign, KnownNat n) => Predicate (CompareValue op sign n :: Type) Source # 
Instance details

Defined in Rerefined.Predicate.Relational.Value

Methods

predicateName :: Proxy# (CompareValue op sign n) -> Int -> ShowS Source #

(KnownNat n, Num a, Ord a, ReifyRelOp op, ReifySignedNat sign n, ReifySign sign) => 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 String) Source #

data Sign Source #

Constructors

Pos 
Neg 

data RelOp Source #

Relational operator.

There are three possible outcomes from compareing two terms, defined in Ordering. However, we may instead compare terms using relational operators such as >=, which are more specific comparisons that return a Bool.

Constructor order is arbitrary due to NEQ, which obstructs ordering in a meaningful way.

Constructors

LT'

< less than

LTE

<= less than or equal to

EQ'

== equal to

NEQ

/= less than or greater than

GTE

>= equal to or greater than

GT'

> greater than

data CompareLength (op :: RelOp) (n :: Natural) Source #

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

Instances

Instances details
(KnownNat n, Foldable f, ReifyRelOp op) => Refine1 (CompareLength op n :: Type) (f :: Type -> Type) Source #

Compare the length of a Foldable to a type-level Natural using the given RelOp.

Instance details

Defined in Rerefined.Predicate.Relational.Length

Methods

validate1 :: forall (a :: k1). Proxy# (CompareLength op n) -> f a -> Maybe (RefineFailure String) Source #

(Typeable op, KnownNat n) => Predicate (CompareLength op n :: Type) Source # 
Instance details

Defined in Rerefined.Predicate.Relational.Length

(KnownNat n, MonoFoldable a, ReifyRelOp op) => Refine (CompareLength op n :: Type) a Source #

Compare the length of a MonoFoldable to a type-level Natural using the given RelOp.

Instance details

Defined in Rerefined.Predicate.Relational.Length