<div dir="ltr">listFilms = [Film] -&gt; IO ()<br>listFilms = putStrLn . show -- point free style<br>listFilms films = putStrLn $ show films<br>listFilms = mapM_ (putStrLn . show) -- put each movie on a separate line, point free style<br>
listFilms films = mapM_ (putStrLn . show) films<br><br>Hope that makes sense...<br><br>Michael<br><br><div class="gmail_quote">On Sun, May 10, 2009 at 5:30 PM, applebiz89 <span dir="ltr">&lt;<a href="mailto:applebiz89@hotmail.com">applebiz89@hotmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I want to write a function to output the entire contents of a list. not sure<br>
of how to do so...This is my list i want to output<br>
<br>
type Title = String<br>
type Director = String<br>
type Year = Int<br>
type Fan = String<br>
<br>
data Film = Film Title Director Year [Fan] deriving Show<br>
<br>
-- List of films<br>
<br>
testDatabase :: [Film]<br>
testDatabase = [(Film &quot;Casino Royale&quot; &quot;Martin Campbell&quot; 2006 [&quot;Garry&quot;,<br>
&quot;Dave&quot;, &quot;Zoe&quot;]) ]<br>
<br>
-------<br>
<br>
I know this isnt right but this is what I have so far<br>
<br>
listFilms :: [Film] -&gt; [Film]<br>
listFilms (film@(Film title director year fans) : films) = putStrLn . show<br>
film<br>
<br>
I know to use show and putStrLn but I just don&#39;t know how to put them into<br>
the function correctly<br>
<br>
thank you.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/displaying-conetents-of-a-list-tp23470633p23470633.html" target="_blank">http://www.nabble.com/displaying-conetents-of-a-list-tp23470633p23470633.html</a><br>
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</font></blockquote></div><br></div>