fork/numbat
git clone https://git.julia.blue/fork/numbat
a75c86e
v1.6.0
1use core::scalar 2use units::currency 3 4# This module is currently not part of the prelude, because the 'exchange_rate_XXX' calls 5# are blocking. In the CLI application, we do however load this module asynchronously after 6# prefetching the exchange rates. 7 8# TODO: once we support strings as function parameters, use 'exchange_rate("USD")' and 9# similar instead of separate functions. 10fn exchange_rate_USD() -> Scalar 11fn exchange_rate_JPY() -> Scalar 12fn exchange_rate_GBP() -> Scalar 13fn exchange_rate_CNY() -> Scalar 14fn exchange_rate_AUD() -> Scalar 15fn exchange_rate_CAD() -> Scalar 16fn exchange_rate_CHF() -> Scalar 17 18@aliases(dollars, USD, $: short) 19unit dollar: Money = EUR / exchange_rate_USD() 20 21@aliases(yens, JPY, ¥: short, 円) 22unit yen: Money = EUR / exchange_rate_JPY() 23 24@aliases(pound_sterling, GBP, £: short) 25unit british_pound: Money = EUR / exchange_rate_GBP() 26 27@aliases(CNY: short, 元) 28unit renminbi: Money = EUR / exchange_rate_CNY() 29 30@aliases(australian_dollars, AUD: short, A$) 31unit australian_dollar: Money = EUR / exchange_rate_AUD() 32 33@aliases(canadian_dollars, CAD: short, C$) 34unit canadian_dollar: Money = EUR / exchange_rate_CAD() 35 36@aliases(swiss_francs, CHF: short) 37unit swiss_franc: Money = EUR / exchange_rate_CHF()