Implementing a very simple 'Wine Rating System' in Haskell

Posted by Alex N on Stack Overflow See other posts from Stack Overflow or by Alex N
Published on 2010-05-08T15:59:27Z Indexed on 2010/05/08 16:08 UTC
Read the original article Hit count: 218

Filed under:
|
|

Hello, I have just started learning Haskell and have got stumped on how to add a rating to a custom data type.

The data type I'm using has a name, a year and a tuple (userName and their rating), it looks like:

data Wine = Wine String Int [Rating] deriving (Eq,Ord,Show,Read)
type Rating = (String, Int)

I wanted to allow a user to rate a given wine from a database, stored as [Wine] but cant figure out how to to it. Any pointers or suggestions would be greatly appreciated! Thanks.

© Stack Overflow or respective owner

Related posts about haskell

Related posts about lists