module Plutarch.Internal.Ord (
PPartialOrd (..),
POrd (..),
) where
import Plutarch.Builtin.Bool (PBool, pif', pnot)
import Plutarch.Internal.Eq (PEq)
import Plutarch.Internal.Lift (pconstant)
import Plutarch.Internal.Other (pto)
import Plutarch.Internal.PlutusType (PInner)
import Plutarch.Internal.Term (S, Term, (#), (#$))
class PEq t => PPartialOrd t where
(#<=) :: Term s t -> Term s t -> Term s PBool
default (#<=) :: POrd (PInner t) => Term s t -> Term s t -> Term s PBool
Term s t
x #<= Term s t
y = Term s t -> Term s (PInner t)
forall (s :: S) (a :: PType). Term s a -> Term s (PInner a)
pto Term s t
x Term s (PInner t) -> Term s (PInner t) -> Term s PBool
forall (s :: S).
Term s (PInner t) -> Term s (PInner t) -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#<= Term s t -> Term s (PInner t)
forall (s :: S) (a :: PType). Term s a -> Term s (PInner a)
pto Term s t
y
(#<) :: Term s t -> Term s t -> Term s PBool
default (#<) :: POrd (PInner t) => Term s t -> Term s t -> Term s PBool
Term s t
x #< Term s t
y = Term s t -> Term s (PInner t)
forall (s :: S) (a :: PType). Term s a -> Term s (PInner a)
pto Term s t
x Term s (PInner t) -> Term s (PInner t) -> Term s PBool
forall (s :: S).
Term s (PInner t) -> Term s (PInner t) -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#< Term s t -> Term s (PInner t)
forall (s :: S) (a :: PType). Term s a -> Term s (PInner a)
pto Term s t
y
(#>=) :: forall (s :: S). Term s t -> Term s t -> Term s PBool
Term s t
x #>= Term s t
y = Term s (PBool :--> PBool)
forall (s :: S). Term s (PBool :--> PBool)
pnot Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
#$ Term s t
x Term s t -> Term s t -> Term s PBool
forall (s :: S). Term s t -> Term s t -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#< Term s t
y
(#>) :: forall (s :: S). Term s t -> Term s t -> Term s PBool
Term s t
x #> Term s t
y = Term s t
y Term s t -> Term s t -> Term s PBool
forall (s :: S). Term s t -> Term s t -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#< Term s t
x
infix 4 #<=
infix 4 #<
infix 4 #>=
infix 4 #>
class PPartialOrd t => POrd t where
pmax :: forall (s :: S). Term s t -> Term s t -> Term s t
pmax Term s t
x Term s t
y = Term s (PBool :--> (t :--> (t :--> t)))
forall (a :: PType) (s :: S).
Term s (PBool :--> (a :--> (a :--> a)))
pif' Term s (PBool :--> (t :--> (t :--> t)))
-> Term s PBool -> Term s (t :--> (t :--> t))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (Term s t
x Term s t -> Term s t -> Term s PBool
forall (s :: S). Term s t -> Term s t -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#< Term s t
y) Term s (t :--> (t :--> t)) -> Term s t -> Term s (t :--> t)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s t
y Term s (t :--> t) -> Term s t -> Term s t
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s t
x
pmin :: forall (s :: S). Term s t -> Term s t -> Term s t
pmin Term s t
x Term s t
y = Term s (PBool :--> (t :--> (t :--> t)))
forall (a :: PType) (s :: S).
Term s (PBool :--> (a :--> (a :--> a)))
pif' Term s (PBool :--> (t :--> (t :--> t)))
-> Term s PBool -> Term s (t :--> (t :--> t))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# (Term s t
x Term s t -> Term s t -> Term s PBool
forall (s :: S). Term s t -> Term s t -> Term s PBool
forall (t :: PType) (s :: S).
PPartialOrd t =>
Term s t -> Term s t -> Term s PBool
#< Term s t
y) Term s (t :--> (t :--> t)) -> Term s t -> Term s (t :--> t)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s t
x Term s (t :--> t) -> Term s t -> Term s t
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s t
y
instance PPartialOrd PBool where
{-# INLINEABLE (#<) #-}
Term s PBool
x #< :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool
#< Term s PBool
y = Term s (PBool :--> (PBool :--> (PBool :--> PBool)))
forall (a :: PType) (s :: S).
Term s (PBool :--> (a :--> (a :--> a)))
pif' Term s (PBool :--> (PBool :--> (PBool :--> PBool)))
-> Term s PBool -> Term s (PBool :--> (PBool :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x Term s (PBool :--> (PBool :--> PBool))
-> Term s PBool -> Term s (PBool :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# AsHaskell PBool -> Term s PBool
forall (a :: PType) (s :: S).
PLiftable a =>
AsHaskell a -> Term s a
pconstant Bool
AsHaskell PBool
False Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
y
{-# INLINEABLE (#<=) #-}
Term s PBool
x #<= :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool
#<= Term s PBool
y = Term s (PBool :--> (PBool :--> (PBool :--> PBool)))
forall (a :: PType) (s :: S).
Term s (PBool :--> (a :--> (a :--> a)))
pif' Term s (PBool :--> (PBool :--> (PBool :--> PBool)))
-> Term s PBool -> Term s (PBool :--> (PBool :--> PBool))
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x Term s (PBool :--> (PBool :--> PBool))
-> Term s PBool -> Term s (PBool :--> PBool)
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
y Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: PType) (b :: PType).
Term s (a :--> b) -> Term s a -> Term s b
# AsHaskell PBool -> Term s PBool
forall (a :: PType) (s :: S).
PLiftable a =>
AsHaskell a -> Term s a
pconstant Bool
AsHaskell PBool
True
instance POrd PBool