Last active
August 16, 2017 11:10
-
-
Save deque-blog/9bd81d6594fdf241c8af5b15a06f574b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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