liqwid-plutarch-extra-3.21.1: A collection of Plutarch extras from Liqwid Labs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Plutarch.Extra.Rational

Synopsis

Documentation

newtype PRationalNoReduce (s :: S) Source #

Wrapper for PRational. Numeric instances of this don't reduce the fraction after each operation.

Constructors

PRationalNoReduce (Term s PRational) 

Instances

Instances details
PEq PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

Methods

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

POrd PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

PPartialOrd PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

Methods

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

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

PIsData PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

DerivePlutusType PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

Associated Types

type DPTStrat PRationalNoReduce Source #

PlutusType PRationalNoReduce Source # 
Instance details

Defined in Plutarch.Extra.Rational

Methods

pcon' :: forall (s :: S). PRationalNoReduce s -> Term s (PInner PRationalNoReduce) Source #

pmatch' :: forall (s :: S) (b :: PType). Term s (PInner PRationalNoReduce) -> (PRationalNoReduce s -> Term s b) -> Term s b Source #

PNum PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

Generic (PRationalNoReduce s) Source # 
Instance details

Defined in Plutarch.Extra.Rational

Associated Types

type Rep (PRationalNoReduce s) :: Type -> Type Source #

type DPTStrat PRationalNoReduce Source # 
Instance details

Defined in Plutarch.Extra.Rational

type PContravariant' PRationalNoReduce Source # 
Instance details

Defined in Plutarch.Extra.Rational

type PCovariant' PRationalNoReduce Source # 
Instance details

Defined in Plutarch.Extra.Rational

type PInner PRationalNoReduce Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

type PVariant' PRationalNoReduce Source # 
Instance details

Defined in Plutarch.Extra.Rational

type Rep (PRationalNoReduce s) Source #

Since: 3.12.2

Instance details

Defined in Plutarch.Extra.Rational

type Rep (PRationalNoReduce s) = D1 ('MetaData "PRationalNoReduce" "Plutarch.Extra.Rational" "liqwid-plutarch-extra-3.21.1-KPadsMN5oqEA2Ctxwq6qig" 'True) (C1 ('MetaCons "PRationalNoReduce" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PRational))))

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

Put a PRational into a wrapper that prevents reducing after every numeric operation.

Since: 3.12.2

preduce' :: forall (s :: S). Term s PRationalNoReduce -> Term s PRational Source #

Free a PRational from its no-reduce-wrapper and reduce it.

Since: 3.12.2

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

Combined multiply-truncate.

Since: 3.9.0

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

Multiply the first argument by the second argument, divide by the third, truncating.

Since: 3.9.0

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

Combined divide-truncate.

Since: 3.9.0

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

Scale a PRational up by a factor indicated by a PInteger, without reducing the fraction.

Note

This merely 'defers' the reduction until later, with possibly a (very) large numerator. Use this only in cases where you know that this won't cause a performance blow-up later.

Since: 3.9.0

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

Scale a PRational down by a factor indicated by a PInteger, without reducing the fraction.

Note

This has the same performance caveats as mulRational.

Since: 3.9.0

pliftTaggedRational :: forall k (tag :: k). HasCallStack => ClosedTerm (PTagged tag PRational) -> Tagged tag Rational Source #

plift for Tagged Rationals (kind polymorphic)

(#%) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PRational infixl 7 Source #

Create a PRational out of two PIntegers. Will error if the denominator is zero.

Since: 3.9.0