plutarch-1.9.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.Rational

Synopsis

Documentation

data PRational s Source #

A Scott-encoded rational number, with a guaranteed positive denominator (and thus, a canonical form).

Note

This is not the Plutarch equivalent of a Plutus Rational; for this, you want PRationalData from plutarch-ledger-api. PRational is designed to optimize for computation: if you want to do any serious work with rational numbers that isn't just passing them around, you want to use (or convert to) PRational.

Constructors

PRational (Term s PInteger) (Term s PPositive) 

Instances

Instances details
PEq PRational Source # 
Instance details

Defined in Plutarch.Rational

Methods

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

PLiftable PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

PAdditiveGroup PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

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

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

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

PAdditiveMonoid PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

pzero :: forall (s :: S). Term s PRational Source #

PAdditiveSemigroup PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

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

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

PIntegralDomain PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

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

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

PMultiplicativeMonoid PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

pone :: forall (s :: S). Term s PRational Source #

PMultiplicativeSemigroup PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

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

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

PRing PRational Source #

@since WIP

Instance details

Defined in Plutarch.Rational

Methods

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

POrd 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 #

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 #

PlutusType PRational Source # 
Instance details

Defined in Plutarch.Rational

Methods

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

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

PShow PRational Source # 
Instance details

Defined in Plutarch.Rational

Methods

pshow' :: forall (s :: S). Bool -> Term s PRational -> Term s PString Source #

PTryFrom PData (PAsData PRational) Source #

NOTE: This instance produces a verified PPositive as the excess output.

Instance details

Defined in Plutarch.Rational

Associated Types

type PTryFromExcess PData (PAsData PRational) :: PType Source #

Methods

ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData PRational), Reduce (PTryFromExcess PData (PAsData PRational) s)) -> Term s r) -> Term s r Source #

Generic (PRational s) Source # 
Instance details

Defined in Plutarch.Rational

Associated Types

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

Methods

from :: PRational s -> Rep (PRational s) x Source #

to :: Rep (PRational s) x -> PRational s Source #

Generic (PRational s) Source # 
Instance details

Defined in Plutarch.Rational

Associated Types

type Code (PRational s) :: [[Type]]

Methods

from :: PRational s -> Rep (PRational s)

to :: Rep (PRational s) -> PRational s

Fractional (Term s PRational) Source #

@since WIP

Instance details

Defined in Plutarch.Rational

type AsHaskell PRational Source # 
Instance details

Defined in Plutarch.Rational

type AsHaskell PRational = Rational
type PlutusRepr PRational Source # 
Instance details

Defined in Plutarch.Rational

type PContravariant' PRational Source # 
Instance details

Defined in Plutarch.Rational

type PCovariant' PRational Source # 
Instance details

Defined in Plutarch.Rational

type PInner PRational Source # 
Instance details

Defined in Plutarch.Rational

type PVariant' PRational Source # 
Instance details

Defined in Plutarch.Rational

type PTryFromExcess PData (PAsData PRational) Source # 
Instance details

Defined in Plutarch.Rational

type Rep (PRational s) Source # 
Instance details

Defined in Plutarch.Rational

type Rep (PRational s) = D1 ('MetaData "PRational" "Plutarch.Rational" "plutarch-1.9.0-FtN0mhIoM9oEvz7Q98pjWP" 'False) (C1 ('MetaCons "PRational" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PInteger)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PPositive))))
type Code (PRational s) Source # 
Instance details

Defined in Plutarch.Rational

type Code (PRational s) = GCode (PRational s)