<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 9:44 PM, Brandon Allbery <span dir="ltr">&lt;<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="im">On Thu, Oct 3, 2013 at 2:31 PM, Corentin Dupont <span dir="ltr">&lt;<a href="mailto:corentin.dupont@gmail.com" target="_blank">corentin.dupont@gmail.com</a>&gt;</span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span style="font-family:courier new,monospace">test :: Bool -&gt; IO ()<br>test foo = do<br>
   let bar = case foo of <br>
       True -&gt;  &quot;Foo&quot;; <br>
       False -&gt; &quot;Bar&quot;<br>   return ()</span><br><br></div><div>while this one does (just adding one space in front of True and False):<br><br><span style="font-family:courier new,monospace">test :: Bool -&gt; IO ()<br>


test foo = do<br>   let bar = case foo of <br>        True -&gt;  &quot;Foo&quot;; <br>        False -&gt; &quot;Bar&quot;<br>   return ()</span></div></div></blockquote><div><br></div></div><div>Do you understand how layout works? Informally, something that is more indented is a continuation of the previous expression, while something equally or less indented is a new expression. In this case, the previous expression is `bar = case foo of` and indenting `True` to the same level as `bar` means you have ended the expression starting with `bar =`. Adding just one extra space indicates that it&#39;s still part of `bar =`.</div>

<div><br></div><div>(ghc is actually being somewhat lenient here; strictly speaking, you are not indented beyond the `case` so it should have ended the `case` expression. ghc allows some sloppiness like this when there absolutely must be something else after, but there are limits mostly imposed by layout introducers like `let` and `do`.)</div>
</div></div></div></blockquote><div><br></div><div>Brandon,<br></div><div><br>Indentation of &#39;case&#39; itself doesn&#39;t matter. The layout is introduced by &#39;of&#39;, and then it&#39;s the indentation of the lexeme which follows &#39;of&#39; that matters. So GHC is correct here.</div>
<br></div><div class="gmail_quote">Roman<br></div></div></div>