2009/5/11 applebiz89 <[email protected]>
> I know to use show and putStrLn but I just don't know how to put them into
> the function correctly
Well I hope we're not doing your homework for you but...
As putStrLn is in the IO monad, listFilms should at least have a signature
like this:
listFilms :: [Film] -> IO ()
Now you know you want to call putStrLn on each item in the list. That means
you want to join a bunch of functions return IO (). That sounds like a job
for sequence_:
listFilms films = sequence_ $ map (putStrLn.show) films
Or the same thing more verbosely:
listFilms [] = return ()
listFilms (film:films)
= do putStrLn (show film)
listFilms films
Hope that helps,
Alex
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe