<div class="gmail_quote">On 24 December 2010 22:07, Daniel Fischer <span dir="ltr">&lt;<a href="mailto:daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5">On Friday 24 December 2010 22:47:55, Aaron Gray wrote:<br>
&gt; On 24 December 2010 18:24, Henning Thielemann<br>
&gt; &lt;<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a><br>
&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Fri, 24 Dec 2010, Aaron Gray wrote:<br>
&gt; &gt;<br>
&gt; &gt;  The compiler is requesting an instance declaration for Show :-<br>
&gt; &gt;<br>
&gt; &gt;&gt;   expr-eval.hs:334:23:<br>
&gt; &gt;&gt;       No instance for (Show ([(String, Int)] -&gt; Int))<br>
&gt; &gt;&gt;         arising from a use of `print&#39; at expr-eval.hs:334:23-27<br>
&gt; &gt;&gt;       Possible fix:<br>
&gt; &gt;&gt;         add an instance declaration for (Show ([(String, Int)] -&gt;<br>
&gt; &gt;&gt; Int)) In the first argument of `(.)&#39;, namely `print&#39;<br>
&gt; &gt;&gt;       In the second argument of `(&gt;&gt;=)&#39;, namely `print . calc .<br>
&gt; &gt;&gt; lexer&#39; In the expression: getContents &gt;&gt;= print . calc . lexer<br>
&gt; &gt;<br>
&gt; &gt; ... maybe &#39;calc&#39; needs a further argument?<br>
&gt;<br>
&gt; I have attached what I have typed in so far.<br>
<br>
</div></div>Well,<br>
<br>
*ExprEval&gt; :t calc<br>
calc :: [Token] -&gt; [(String, Int)] -&gt; Int<br>
<br>
calc needs an environment (a dictionary of let-bound names), which you have<br>
to provide.<br>
<br>
main = print . flip calc [] . lexer<br>
<br>
works fine.<br></blockquote><div><br></div><div>Okay great, works this end too, but what does the &#39;flip&#39; do ???</div><div><br></div><div>Now to get it to work as a REPL and to read from file :)</div><div><br></div>

<div>Aaron</div><div> </div></div>