Created
May 15, 2020 08:31
-
-
Save lu4nm3/17cc7acb19e8af6db92847c6a0e90cb3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def orderTotal(shoppingCart: List[Item]): Double = { | |
shoppingCart.foldLeft(0.0) { case (total, item) => | |
total + implicitly[Price[Item]].price(item) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment