Skip to content

Instantly share code, notes, and snippets.

@ljwagerfield
Created November 30, 2018 10:27
Show Gist options
  • Save ljwagerfield/40429bdecd90e2a24983c3f6294a64a3 to your computer and use it in GitHub Desktop.
Save ljwagerfield/40429bdecd90e2a24983c3f6294a64a3 to your computer and use it in GitHub Desktop.
case class Product(id: Int, price: Int, inStock: Boolean)
case class Basket(productIds: List[Int])
trait ProductRepo {
def getProduct(productId: Int): Product
}
trait ShoppingBasketRepo {
def getShoppingBasket(basketId: Int): Basket
}
object Application extends App {
val productRepo: ProductRepo = ??? // Assume this is implemented
val basketRepo: ShoppingBasketRepo = ??? // Assume this is implemented
def getBasketTotal(basketId: Int, inStockItemsOnly: Boolean): Int = {
??? // Todo: Implement
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment