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, Zoe")]
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])