applebiz89 wrote:
becomeFan :: Title -> fanName -> [Film] -> [Film]
becomeFan _ _ [] = []
becomeFan Title fanName ((Film Title Director Year fan):xs)
| filmName == title = (Film Title Director Year fanName:fan) : xs
| otherwise = (Film Title Director Year fan) : becomeFan Title fanName
xs
In the type signature, you have to use types. In other words, use "Fan"
instead of "fanName" in the first line.
Variables have to begin with a lowercase letter. In other words, use
"title", "director", "year" instead of "Title", "Director", "Year".
Regarding the IO: I still propose to get your pure functions to work
first, then worry about IO. You can test your code by loading it into ghci.
> ghci nameofmyfile.hs
If everything works (i.e. no compile errors), you can call your
functions at the prompt:
> becomeFan "Casine Royale" "apple", testDatabase
Now ghci should answer with something like the following:
[(Film "Casino Royale" "Martin Campbell" 2006
["apple", "Garry", "Dave", "Zoe"])]
This way, you can test your stuff while working on it.
Tillmann
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe