| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Plutarch.Rational
Synopsis
- data PRational (s :: S) = PRational (Term s PInteger) (Term s PPositive)
- preduce :: forall (s :: S). Term s (PRational :--> PRational)
- pnumerator :: forall (s :: S). Term s (PRational :--> PInteger)
- pdenominator :: forall (s :: S). Term s (PRational :--> PPositive)
- pfromInteger :: forall (s :: S). Term s (PInteger :--> PRational)
- pround :: forall (s :: S). Term s (PRational :--> PInteger)
- ptruncate :: forall (s :: S). Term s (PRational :--> PInteger)
- pproperFraction :: forall (s :: S). Term s (PRational :--> PPair PInteger PRational)
Documentation
data PRational (s :: 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.