All the worlds currencies.
This type represents all the possible currencies as currency codes.
all : List Currency
All the currency codes in a list
all =
[ USD
, EUR
, CAD
--..
]
toString : Currency -> String
Get the currency's code as a String
toString CNY == "CNY"
fromString : String -> Maybe Currency
Attempt to derive a Currency
from a String
. This function presumes the String
is a currency code like "USD"
.
fromString "DKK" == Just DKK
fromString "Danish Krone" == Nothing
toSymbol : Currency -> String
Get the symbol of a currency from its code
toSymbol USD == "$"
toSymbol CAD == "CA$"
toSymbol BTC == "BTC"
Look at the documentation for toNativeSymbol
for more details.
toName : { plural : Basics.Bool } -> Currency -> String
Get the name of a currency from its code
toName { plural = True } EUR == "euros"
toName { plural = False } ALL == "Albanian Lek"
toName { plural = True } ALL == "Albanian lekë"
toNativeSymbol : Currency -> String
Get the native symbol of a currency from its code.
toNativeSymbol LAK == "ກີບ"
toSymbol LAK == "₭"
toNativeSymbol CAD == "$"
toSymbol CAD == "CA$"
toNativeSymbol USD == "$"
toSymbol USD == "$"
The native symbol
is different from the symbol
. The symbol
is what is used
in international currency exchange contexts. Imagine a currency exchange shop
at an airport that lists several currencies right next to each other. The native symbol,
however, is used in more local and natural settings of the currency; such as if someone
were looking at a restaurant menu with currency amounts next to menu items.
toDecimalDigits : Currency -> Basics.Int
Get the number of decimal digits in a currency. of a currency from its code
The decimal digits is basically the size of the smaller unit the currency comes in.
American dollars and Euros, for example, both have cents, and 100 cents make a dollar or Euro. So the decimal
digits for these currencies is 2
. Extreme cases include the Japanese Yen, which has 0
, and
Bitcoin, which has 8
.
search : String -> List Currency
Search all currencies by case-insensitive string matching on the name, symbol, and code.
searchCustom : String -> List Currency -> List Currency
Search through a list of currencies by case-insensitive string matching on the name, symbol, and code.