Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mgryszko
Created February 12, 2021 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgryszko/57b56fc75b5b3a5d15a46ca29ce6e183 to your computer and use it in GitHub Desktop.
Save mgryszko/57b56fc75b5b3a5d15a46ca29ce6e183 to your computer and use it in GitHub Desktop.
val (x, y, z) = (1.eur, 2.eur, 3.eur)
test("associativity") {
assert(((x |+| y) |+| z) == (x |+| (y |+| z)))
}
test("left identity") {
assert((Monoid.empty |+| x) == x)
}
test("right identity") {
assert((x |+| Monoid.empty) == x)
}
implicit class IntToFastMoneyConversions(amount: Int) {
val eur: FastMoney = FastMoney.of(amount, "EUR")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment