Rate

world.money.rates$package.Rate
object Rate

Factories and accessors for Rate.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Rate.type

Members list

Type members

Classlikes

final case class Invalid(value: BigDecimal) extends WorldError

Carries the rejected value.

Carries the rejected value.

Attributes

Supertypes
trait Product
trait Equals
class WorldError
class TypedError
trait NoStackTrace
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def andThen[F <: Currency & Singleton, T <: Currency & Singleton, U <: Currency & Singleton](r: Rate[F, T], next: Rate[T, U]): Rate[F, U]

Cross-rate composition through a pivot, exact.

Cross-rate composition through a pivot, exact.

Attributes

def inverse[F <: Currency & Singleton, T <: Currency & Singleton](r: Rate[F, T], scale: Int, mode: Rounding): Rate[T, F]

The reciprocal rate at an explicit scale and mode.

The reciprocal rate at an explicit scale and mode.

Attributes

def of[F <: Currency & Singleton, T <: Currency & Singleton](value: BigDecimal): Either[Invalid, Rate[F, T]]
def of(from: Currency, to: Currency)(value: BigDecimal): Either[Invalid, Rate[from.type, to.type]]

Builds a rate between two runtime-known currencies, typed by their singletons.

Builds a rate between two runtime-known currencies, typed by their singletons.

Attributes

Givens

Givens

given given_CanEqual_Rate_Rate: [F <: Currency & Singleton, T <: Currency & Singleton] => CanEqual[Rate[F, T], Rate[F, T]]

Extensions

Extensions

extension [F <: Currency & Singleton, T <: Currency & Singleton](r: Rate[F, T])
def andThen[U <: Currency & Singleton](next: Rate[T, U]): Rate[F, U]

Cross-rate composition through a pivot, exact: usdToEur.andThen(eurToKes).

Cross-rate composition through a pivot, exact: usdToEur.andThen(eurToKes).

Attributes

def inverse(scale: Int, mode: Rounding): Rate[T, F]

The reciprocal rate. Inexact in general, so it is one correctly-rounded division at the scale and mode given here rather than through an intermediate context.

The reciprocal rate. Inexact in general, so it is one correctly-rounded division at the scale and mode given here rather than through an intermediate context.

Attributes

def value: BigDecimal