Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- Given these expressions
let a = money 30 "USD"
let b = money 25 "EUR"
let c = money 1000 "JPY"
-- Add the different currencies
add (add a (multiply b 2)) c
-- It returns the following AST:
MoneyAdd
[ MoneyAdd
[ KnownAmount (Money {amount = 30.0, currency = "USD"})
, MoneyMul (KnownAmount (Money {amount = 25.0, currency = "EUR"})) 2.0]
, KnownAmount (Money {amount = 1000.0, currency = "JPY"})]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment