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

1 Expert Approved Answer
Step: 1 Unlock

type Customer String type Product String data Order Order Customer Product Double deriving Show data ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!