You can comment out the definition of bad and add a new one:<br><span style="font-family: courier new,monospace;">bad = undefined</span><br>The
file should load properly. Functions that use &quot;bad&quot; will compile too,
but if they try to evaluate it an error will be raised.<br><br>(sorry, forgot to hit &quot;reply to all&quot; the first time)<br><br><div class="gmail_quote">On Thu, Apr 16, 2009 at 1:34 PM, aditya siram <span dir="ltr">&lt;<a href="mailto:aditya.siram@gmail.com">aditya.siram@gmail.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;">Hi all,<br>I&#39;m curious as to how one would go about debugging the following program:<br>
<font size="1"><span style="font-family: courier new,monospace;"><br>hello :: String</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">hello = &quot;Hello&quot;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">world :: String</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">world = &quot;World&quot;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">number :: Int</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">number = 1</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">helloWorld :: String</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">helloWorld = hello ++ &quot; &quot; ++ world</span><br style="font-family: courier new,monospace;"><br>-- This fails!<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bad :: String</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">bad = hello ++ number</span></font><br><br>Predictably once I load this program into ghci I get the following error:<br><font size="1"><span style="font-family: courier new,monospace;">[1 of 1] Compiling Main             ( TestCode.hs, interpreted )</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">TestCode.hs:14:15:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Couldn&#39;t match expected type `[Char]&#39; against inferred type `Int&#39;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    In the second argument of `(++)&#39;, namely `number&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    In the expression: hello ++ number</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    In the definition of `bad&#39;: bad = hello ++ number</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Failed, modules loaded: none.</span><br style="font-family: courier new,monospace;">

</font><br>At this point what I want to do is to query the output type of the different functions like so:<br><font size="1"><span style="font-family: courier new,monospace;">&gt; :t hello</span></font><br>but GHCI won&#39;t let me because the program hasn&#39;t been loaded. <br>

<br>I would then have to comment out &#39;bad&#39;, reload the program and query output types to my hearts content. This is fine for a small program, but when I have functions are downriver from &#39;bad&#39;, it gets extremely cumbersome. Is there a way to load a file such that functions that compile stay loaded in the interpreter even if something else fails?<br>

<br>Thanks ...<br>-deech<br>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br>