Question: How do I complete the function below so that it takes a list of all products that have been ordered, with the total quantity of
How do I complete the function below so that it takes a list of all products that have been ordered, with the total quantity of each.
productQuantities :: [Order] -> [(Product, Double)]
Type definitions:
type Customer = String
type Product = String
An order of some quantity of a product by a customer is described by the type
data Order = Order Customer Product Double deriving (Show)
A delivery to the supplier of some quantity of a product is described by the type
data Delivery = Delivery Product Double deriving (Show)
Step by Step Solution
3.45 Rating (161 Votes )
There are 3 Steps involved in it
type Customer String type Product String data Order Order Customer Product Double deriving Show data ... View full answer
Get step-by-step solutions from verified subject matter experts
