<div dir="ltr">Just to be clear, I *think* layout rules don't apply here at all, actually. <div><br></div><div>If I understand correctly, "layout" has to do with turning spacing into braces and semicolons. A new line is a semicolon. A brace group is inserted around things that are aligned where a brace group actually makes sense.</div><div><br></div><div>e.g. </div><div><br></div><div><font face="monospace, monospace">let x = y</font></div><div><font face="monospace, monospace">    y = z </font></div><div><font face="monospace, monospace">  in ...</font></div><div><br></div><div>gets turned into roughly</div><div><br></div><div><font face="monospace, monospace">let { x = y</font></div><div><font face="monospace, monospace">    ; y = z</font></div><div><font face="monospace, monospace">    } in ...</font></div><div><br></div><div>if-then-else however is just an expression, like a ternary operator, so it doesn't need any semicolons or braces. So layout is unrelated, except for the issue of `do` blocks inserting semicolons into `if-then-else` groups (and that's what DoAndIfThenElse fixes).</div><div><br></div><div>-- Andrew</div><div><br></div><div>PS. I am very glad someone is working on ghc-exactprint. It's a really important step in developing better Haskell tooling, imho. Doing that sort of thing right now with haskell-src-exts right now is a real pain (see half of the closed issues on hindent... about how it doesn't preserve formatting in many places.)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 10, 2015 at 9:25 AM, Alan & Kim Zimmerman <span dir="ltr"><<a href="mailto:alan.zimm@gmail.com" target="_blank">alan.zimm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Ok, adding a do does make a difference. More complexity.<br><br></div>Thanks<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">  Alan<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 10, 2015 at 6:06 PM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Mar 10, 2015 at 12:01 PM, Alan & Kim Zimmerman <span dir="ltr"><<a href="mailto:alan.zimm@gmail.com" target="_blank">alan.zimm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I am working on ghc-exactprint, and need to flag points where layout must be preserved, and considering the `if` statement.<br><br>My understanding of the layout rules for if then else is that the `then` has to start more to the right than the `if`.<br></div></div></div></div></blockquote><div><br></div></span><div>I believe you are looking for DoAndIfThenElse.</div><span><font color="#888888"><div><br></div></font></span></div><span><font color="#888888">-- <br><div><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</font></span></div></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>