[Haskell-cafe] Getting started - help

applebiz89 applebiz89 at hotmail.com
Thu Apr 30 07:33:23 EDT 2009

What I need to do is build a type of database. Firstly have a few questions,
whether what I have done it right...and how to do something else. 

This is my algebraic type for the database (correct me if its wrong) 

data Film = Film String String Int String 

with this as the data. 

testDatabase :: [Film] 
testDatabase = [("Casino Royale", "Martin Campbell",2006, "Garry, Dave,

the last set of strings are the fans to the film. I want to be able to add a
new fan, but not sure how to specifically insert it to there 

this is what I have so far: 

becomeFan :: String -> String -> [Film] -> [Film] 
becomeFan = do putStr "Which film are you a fan of:  " 
            filmTitle <- getLine 
            do putStr "What is your name: " 
            fanName <- getLine 
            (if filmTitle == filmName then fanName : [Film]) 
View this message in context: http://www.nabble.com/Getting-started---help-tp23314466p23314466.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list