What would you expect the program to output? You probably mean &#39;testDatabase&#39; instead of &#39;films&#39;.<div><br clear="all">/jve<br>
<br><br><div class="gmail_quote">On Tue, May 12, 2009 at 12:59 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="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I have compiled each function independently and they have compiled the only<br>
problem is the main function..<br>
<br>
I keep getting the error &#39;films not defined&#39; and I am not sure why<br>
<br>
[code]<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>
-- Function<br>
<br>
filmsInGivenYear :: Year -&gt; [Film] -&gt; [String]<br>
filmsInGivenYear year&#39; films = [ title | (Film title director year fans) &lt;-<br>
films, year == year&#39;]<br>
<br>
doFilmsInGivenYear :: [Film] -&gt; IO ()<br>
doFilmsInGivenYear films  = do putStrLn &quot;which year?&quot;<br>
                               text &lt;- getLine<br>
                               let year&#39; = read text :: Int<br>
                               let answer = filmsInGivenYear year&#39; films<br>
                               print answer<br>
<br>
main :: IO ()<br>
main = do<br>
         doFilmsInGivenYear films<br>
         main<br>
<br>
[/code]<br>
<br>
if the other functions are compiling without this error im not sure as to<br>
why the main function does not compile because of the films...any light on<br>
this?<br>
<br>
Thanks<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Main-function-error-tp23506481p23506481.html" target="_blank">http://www.nabble.com/Main-function-error-tp23506481p23506481.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>