plutarch-1.9.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.Internal.Ord

Synopsis

Documentation

class PEq t => PPartialOrd t where Source #

Partial ordering relation.

Laws

#<= must form a partial order. More precisely:

  1. x #<= x = True (#<= is reflexive)
  2. (x #<= y) #&& (y #<= x) = x #== y (#<= is anti-symmetric)
  3. (x #<= y) #&& (y #<= z) = x #<= z (@#<= is transitive)

Furthermore, #< must be an equivalent strict partial order to #<=:

  1. x #<= y = (x #< y) #|| (x #== y)
  2. x #< x = False (#< is irreflexive)
  3. x #< y = pnot (y #< x) (#< is asymmetric)
  4. (x #< y) #&& (y #< z) = x #< z (#< is transitive)

Lastly, if you define #>= or #>, ensure that the following also hold:

  1. x #> y = y #< x
  2. x #>= y = pnot (x #< y)

The default implementations of #>= and #> ensure these laws.

Minimal complete definition

Nothing

Methods

(#<=) :: Term s t -> Term s t -> Term s PBool infix 4 Source #

default (#<=) :: POrd (PInner t) => Term s t -> Term s t -> Term s PBool Source #

(#<) :: Term s t -> Term s t -> Term s PBool infix 4 Source #

default (#<) :: POrd (PInner t) => Term s t -> Term s t -> Term s PBool 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

Instances details
PPartialOrd PBitString Source #

@since WIP

Instance details

Defined in Plutarch.BitString

Methods

(#<=) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source #

PPartialOrd PBool Source # 
Instance details

Defined in Plutarch.Internal.Ord

Methods

(#<=) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

PPartialOrd PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

(#<=) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source #

PPartialOrd PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

(#<=) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source #

PPartialOrd PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

PPartialOrd PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Methods

(#<=) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

PPartialOrd PInteger Source # 
Instance details

Defined in Plutarch.Integer

Methods

(#<=) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source #

PPartialOrd PPositive Source # 
Instance details

Defined in Plutarch.Positive

Methods

(#<=) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source #

PPartialOrd PRational Source # 
Instance details

Defined in Plutarch.Rational

Methods

(#<=) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source #

(PIsData a, PPartialOrd a) => PPartialOrd (PDataNewtype a) Source #

Since: 1.7.0

Instance details

Defined in Plutarch.Builtin

Methods

(#<=) :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s PBool Source #

(SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => PPartialOrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

(#<=) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source #

(POrd x, PIsData x) => PPartialOrd (PDataRecord '[label ':= x]) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

(#<=) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source #

PPartialOrd (PDataRecord ('[] :: [PLabeledType])) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

(#<=) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source #

All (Compose POrd PDataRecord) defs => PPartialOrd (PDataSum defs) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

(#<=) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source #

PPartialOrd (PUnit :: S -> Type) Source # 
Instance details

Defined in Plutarch.Unit

Methods

(#<=) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source #

(PPartialOrd a, PPartialOrd b, PIsData a, PIsData b) => PPartialOrd (PEitherData a b) Source #

@since WIP

Instance details

Defined in Plutarch.Either

Methods

(#<=) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source #

(#<) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source #

(#>) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source #

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:

  1. pmax x y = pmax y x (pmax is commutative)
  2. pmin x y = pmin y x (pmin is commutative)
  3. pmax x (pmax y z) = pmax (pmax x y) z (pmax is associative)
  4. pmin x (pmin y z) = pmin (pmin x y) z (pmin is associative)
  5. pmax x (pmin y z) = pmin (pmax x y) (pmax x z) (pmax distributes over pmin)
  6. pmin x (pmax y z) = pmax (pmin x y) (pmin x z) (pmin distributes over pmax)

Furthermore, the following must hold relative #<:

  1. pmin x y = if (x #< y) then x else y
  2. 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.

Minimal complete definition

Nothing

Methods

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

Instances

Instances details
POrd PBitString Source #

@since WIP

Instance details

Defined in Plutarch.BitString

Methods

pmax :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBitString Source #

pmin :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBitString Source #

POrd PBool Source # 
Instance details

Defined in Plutarch.Internal.Ord

Methods

pmax :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

pmin :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source #

POrd PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

pmax :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source #

pmin :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source #

POrd PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

pmax :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source #

pmin :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source #

POrd PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

POrd PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Methods

pmax :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source #

pmin :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source #

POrd PInteger Source # 
Instance details

Defined in Plutarch.Integer

Methods

pmax :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source #

pmin :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source #

POrd PPositive Source # 
Instance details

Defined in Plutarch.Positive

Methods

pmax :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source #

pmin :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source #

POrd PRational Source # 
Instance details

Defined in Plutarch.Rational

Methods

pmax :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source #

pmin :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source #

(PIsData a, PPartialOrd a) => POrd (PDataNewtype a) Source #

Since: 1.7.0

Instance details

Defined in Plutarch.Builtin

Methods

pmax :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s (PDataNewtype a) Source #

pmin :: forall (s :: S). Term s (PDataNewtype a) -> Term s (PDataNewtype a) -> Term s (PDataNewtype a) Source #

(SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => POrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

pmax :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source #

pmin :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source #

(POrd x, PIsData x) => POrd (PDataRecord '[label ':= x]) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

pmax :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source #

pmin :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source #

POrd (PDataRecord ('[] :: [PLabeledType])) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

pmax :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) Source #

pmin :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) Source #

All (Compose POrd PDataRecord) defs => POrd (PDataSum defs) Source # 
Instance details

Defined in Plutarch.DataRepr.Internal

Methods

pmax :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source #

pmin :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source #

POrd (PUnit :: S -> Type) Source # 
Instance details

Defined in Plutarch.Unit

Methods

pmax :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source #

pmin :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source #

(PPartialOrd a, PPartialOrd b, PIsData a, PIsData b) => POrd (PEitherData a b) Source #

@since WIP

Instance details

Defined in Plutarch.Either

Methods

pmax :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s (PEitherData a b) Source #

pmin :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s (PEitherData a b) Source #