<div dir="auto"><div>Tom,<div dir="auto"><br></div><div dir="auto">Why does "b" evaluate before "a" in your example? I would have thought left-hand and then right-hand if needed. I'm on my phone but I'd like to try the same example with booleans and `&&` instead of `+`.</div><div dir="auto"><br></div><div dir="auto">Erik</div><br><br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 22, 2018, 11:40 PM Tom Ellis <<a href="mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk" target="_blank" rel="noreferrer">tom-lists-haskell-cafe-2017@jaguarpaw.co.uk</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Dec 22, 2018 at 09:52:18AM +0100, Damien Mattei wrote:<br>
> i have inserted trace statement that output variable<br>
> ... i have strange behavior of output:<br>
<br>
Let's take a simpler example.  Do you understand why the trace statments<br>
from this small program appear in the order that they do?  (And for what<br>
it's worth I really think you'll be better off writing programs using do<br>
notation).<br>
<br>
<br>
% cat test.hs<br>
import Debug.Trace<br>
<br>
result =<br>
  let a = trace "evaluating a" 2<br>
      b = trace "evaluating b" 10<br>
      c = trace "evaluating c" (a + b)<br>
  in c<br>
~% ghci -e result test.hs<br>
evaluating c<br>
evaluating b<br>
evaluating a<br>
12<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div></div>