I have compiled each function independently and they have compiled the only
problem is the main function..

I keep getting the error 'films not defined' and I am not sure why

[code]

type Title = String
type Director = String
type Year = Int
type Fan = String

data Film = Film Title Director Year [Fan] deriving Show
        
-- List of films

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

-- Function 

filmsInGivenYear :: Year -> [Film] -> [String]
filmsInGivenYear year' films = [ title | (Film title director year fans) <-
films, year == year']

doFilmsInGivenYear :: [Film] -> IO ()
doFilmsInGivenYear films  = do putStrLn "which year?"
                               text <- getLine
                               let year' = read text :: Int
                               let answer = filmsInGivenYear year' films
                               print answer

main :: IO ()
main = do 
         doFilmsInGivenYear films
         main

[/code]

if the other functions are compiling without this error im not sure as to
why the main function does not compile because of the films...any light on
this?

Thanks
-- 
View this message in context: 
http://www.nabble.com/Main-function-error-tp23506481p23506481.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to