Created
May 16, 2020 20:00
-
-
Save lu4nm3/98e435856854fcc28e63f5d503ff33bc 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 = { | |
import PriceCompanion._ | |
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