Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Haskell help please

Status
Not open for further replies.

Cybertronic

Technical User
May 18, 2006
19
I thought this would be the best place to ask about for Haskell, I apologise if I've put it in the wrong place, sorry!

I'm trying to create a function called display where I type in a product name, e.g. dvd1, it returns the string and the total value of the stock held for the product:

Here's what I've done so far:

type Product = (Int,String,Int,Double)

dvd1 :: Product
dvd1 = (1, "Space", 5, 9.99)

display :: Product -> String
display (c,d,q,i) = d

My display function only shows the string but unfortunately I'm stuck on how to get the display function to multiply q (Int) and i (Double) together and display it next to d.

Can someone help me out pretty please? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top