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

Plutarch.Extra.ExchangeRate

Synopsis

Documentation

data (a :: Symbol) :> (b :: Symbol) Source #

Represents an exchange from a to b.

For example, suppose 1.00 ADA is worth 2.00 USD. Then ADA :> USD represents scaling by 2.0.

Since: 3.9.0

Exchange-rate conversions

exchangeFromTruncate :: forall (a :: Symbol) (b :: Symbol) (s :: S). Term s (PTagged (a :> b) PRational :--> (PTagged a PInteger :--> PTagged b PInteger)) Source #

Exchange from one currency to another, truncating the result.

Since: 3.9.0

exchangeToTruncate :: forall (a :: Symbol) (b :: Symbol) (s :: S). Term s (PTagged (a :> b) PRational :--> (PTagged b PInteger :--> PTagged a PInteger)) Source #

Exchange from one currency to another, truncating the result (inverse direction).

Since: 3.9.0

exchangeFrom :: forall (a :: Symbol) (b :: Symbol) (s :: S). Term s (PTagged (a :> b) PRational :--> (PTagged a PInteger :--> PTagged b PRational)) Source #

Convert between quantities of currencies using a PRational conversion value.

Since: 3.9.0

exchangeTo :: forall (a :: Symbol) (b :: Symbol) (s :: S). Term s (PTagged (a :> b) PRational :--> (PTagged b PInteger :--> PTagged a PRational)) Source #

Convert between quantities of currencies, in the inverse direction.

Since: 3.9.0