world.money
Members list
Type members
Classlikes
A type-safe representation of a monetary amount, parameterised by its currency.
A type-safe representation of a monetary amount, parameterised by its currency.
This is a pure data aggregate combining a numeric world.money.currency.CurrencyValue with a specific Currency C. This design ensures that arithmetic operations between different currencies are prevented at compile time, eliminating a common source of errors.
All operations on Money instances are provided as extension methods in the companion object, maintaining strict separation of data from behaviour.
===How to Create Money Instances===
There are two primary ways to create an instance of Money.
- Currency-Specific Syntax (Recommended): The preferred method for creating amounts of a known currency is to use the generated syntax extensions. This provides a clean, readable, and type-safe DSL.
import world.money.*
// Creates a Money instance with the type Money[Currencies.KES.type]
val tenShillings = 10.KES
val fiftyRiyals = 50.50.OMR
- Generic Factory
Money.apply: For generic programming, where the currency typeCis a type parameter, you can use the companion object'sapplymethod. This requires aValueOf[C]to be available in the implicit scope to provide the runtime currency object.
import world.money.currency.{Currency, Currencies}
def createGenericMoney[C <: Currency](value: BigDecimal)(using ValueOf[C]): Money[C] = {
Money(value) // Uses Money.apply[C](...)
}
val genericKES = createGenericMoney[Currencies.KES.type](100)
Type parameters
- C
-
The singleton type of the currency, constrained to be a subtype of world.money.currency.Currency.
Value parameters
- currency
-
A
ValueOfinstance that provides the currency object at runtime. - value
-
The numeric value of the amount.
Attributes
- Companion
- object
- Source
- money.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Provides factory methods for creating Money instances
Provides factory methods for creating Money instances
Attributes
- Companion
- class
- Source
- money.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Money.type
Defines the hierarchy of errors for money-related operations.
Defines the hierarchy of errors for money-related operations.
This object provides a central location for all error types that can be returned by the library, including those related to arithmetic, formatting, currency validation, and currency conversion.
Attributes
- Source
- money_errors.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
errors.type
Extensions
Extensions
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala
Attributes
- Source
- CurrencyFactorySyntax.scala