As aditya pointed out, you need to declare any function you use (or provide a type signature of) but don&#39;t explicitly define as undefined. That will allow the code to compile but will throw an error when any undefined functions are called.<br>
<br>I want to address what Jakub said however as I think it&#39;s somewhat misleading.<br><br>On Mon, Apr 16, 2012 at 17:55, Jakub Oboza <span dir="ltr">&lt;<a href="mailto:jakub.oboza@gmail.com">jakub.oboza@gmail.com</a>&gt;</span> wrote:<br>

&gt; Because GHC is limited<br>
&gt; 
<br>
&gt; 
in GHC you cant do<br>
&gt; 
<br>
&gt; 
double a = a * a<br>
&gt; 
<br>
&gt; 
you have to put into let<br>
&gt; 
like this<br>

&gt; <br>
&gt; 
let double a = a * a<br>

&gt; <br>
&gt; Cheers!<br>
<br>It might be more accurate to say that GHCi (the interactive shell, not GHC the compiler) makes some assumptions about what you&#39;re typing in order to make it more useful. For example, GHCi assumes that you&#39;re always typing something of the form:<br>
<br>IO a<br><br>This is why you need to change most &quot;normal&quot; haskell expressions into let bindings, because then you&#39;re explicitly telling GHCi that you don&#39;t want to interpret what you&#39;re typing as an IO expression. The reason it makes that assumption is because often times you really do want it interpreted as IO as in the example:<br>
<br>ghci&gt; putStrLn $ &quot;Example &quot; ++ show 5<br>Example 5<br><br>It also makes assumptions about types of constants that GHC normally does not. Furthermore it allows rebinding of declarations as in:<br><br>ghci&gt; let x = 5<br>
ghci&gt; x<br>5<br>ghci&gt; let x = 6<br>ghci&gt; x<br>6<br><br>You need to be careful with that though because something like this will not behave as you might expect:<br><br>ghci&gt; let x = 5<br>ghci&gt; let f = x * x<br>
ghci&gt; f<br>25<br>ghci&gt; let x = 10<br>ghci&gt; f<br>25<br><br>GHCi is very powerful and a great way to experiment and test code out, but it&#39;s important to understand some of the assumptions it makes in order to be more productive in the majority of cases. On Linux it&#39;s often best to start with an empty hs file, load that into GHCi, and then use :edit to open it in an editor and fill the contents out. You can then save and exit your editor and it will return you to the GHCi prompt where you can experiment and inspect the code you&#39;ve written.<br clear="all">
<br>-R. Kyle Murphy<br>--<br>Curiosity was framed, Ignorance killed the cat.<br>