<div class="gmail_quote">On 24 December 2010 22:07, Daniel Fischer <span dir="ltr"><<a href="mailto:daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>></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>
> On 24 December 2010 18:24, Henning Thielemann<br>
> <<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a><br>
><br>
> > wrote:<br>
> ><br>
> ><br>
> > On Fri, 24 Dec 2010, Aaron Gray wrote:<br>
> ><br>
> > The compiler is requesting an instance declaration for Show :-<br>
> ><br>
> >> expr-eval.hs:334:23:<br>
> >> No instance for (Show ([(String, Int)] -> Int))<br>
> >> arising from a use of `print' at expr-eval.hs:334:23-27<br>
> >> Possible fix:<br>
> >> add an instance declaration for (Show ([(String, Int)] -><br>
> >> Int)) In the first argument of `(.)', namely `print'<br>
> >> In the second argument of `(>>=)', namely `print . calc .<br>
> >> lexer' In the expression: getContents >>= print . calc . lexer<br>
> ><br>
> > ... maybe 'calc' needs a further argument?<br>
><br>
> I have attached what I have typed in so far.<br>
<br>
</div></div>Well,<br>
<br>
*ExprEval> :t calc<br>
calc :: [Token] -> [(String, Int)] -> 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 'flip' 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>