<div dir="ltr">It would be quite useful. It allows us to write <div><br></div><div>    foo $!%$*~ runBarT do ...</div><div><br></div><div>Instead of</div><div><br></div><div>    (foo $!%$*~) $ runBarT $ do ... </div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-06 7:55 GMT+09:00 Andrew Gibiansky <span dir="ltr"><<a href="mailto:andrew.gibiansky@gmail.com" target="_blank">andrew.gibiansky@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I'd like to propose a GHC extension called (for now) `ArgumentBody`. `ArgumentBody` is a simple syntax extension, than, when enabled, permits the following code:<div><br></div><div><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);font-size:13px;background-image:initial;background-repeat:initial"><span style="color:rgb(153,0,0);font-weight:bold">main</span> <span style="font-weight:bold">=</span> when <span style="color:rgb(68,85,136);font-weight:bold">True</span> <span style="font-weight:bold">do</span>
  putStrLn <span style="color:rgb(187,136,68)">"Hello!"</span></pre><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);font-size:13px;background-image:initial;background-repeat:initial"><span style="color:rgb(187,136,68)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);font-size:13px;background-image:initial;background-repeat:initial"><span style="color:rgb(187,136,68)"><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);background-image:initial;background-repeat:initial"><span style="color:rgb(153,0,0);font-weight:bold">main</span> <span style="font-weight:bold">=</span> forM values <span style="color:rgb(153,0,0);font-weight:bold">\</span>value <span style="font-weight:bold">-></span>
  print value</pre><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);background-image:initial;background-repeat:initial"><br></pre><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(0,0,0);background-image:initial;background-repeat:initial"><pre style="margin-top:0px;margin-bottom:0px;overflow:auto;background-image:initial;background-repeat:initial"><span style="color:rgb(153,0,0);font-weight:bold">main</span> <span style="font-weight:bold">=</span> forM values <span style="color:rgb(153,0,0);font-weight:bold">\</span><span style="font-weight:bold">case</span>
    <span style="color:rgb(68,85,136);font-weight:bold">Just</span> x <span style="font-weight:bold">-></span> print x
    <span style="color:rgb(68,85,136);font-weight:bold">Nothing</span> <span style="font-weight:bold">-></span> print y</pre></pre></span></pre><div><br></div><div>In this code we do not need `$` before `do`, lambda, or lambda-case (if -XLambdaCase is enabled). This change would <i>not</i> extend to `let`, `if`, `case`, or any other constructs.</div><div><br></div><div>Pros:</div><div><br></div><div>1. Code is simpler and it greatly reduces the need for "operator line noise" of $ everywhere.</div><div>2. We can avoid using the <a href="http://stackoverflow.com/questions/9468963/runst-and-function-composition" target="_blank">type-checker hack for $</a> for things such as runSt.</div><div><br></div><div>Cons:</div><div><br></div><div>1. Adds complexity to the compiler. (NB: The change is minimal and not invasive at all.)</div><div>2. Contributes to a proliferation of extensions that other tools must support.  (NB: This is just a parser change so should be easy for all tools to support.)</div><div><br></div><div>I'm very interested in hearing both favoring and dissenting opinions on this proposed change. If this change is approved of, names besides -XArgumentBody can be considered.</div><div><br></div><div>See more info <a href="https://ghc.haskell.org/trac/ghc/ticket/10843#ticket" target="_blank">on Trac</a>.</div></div><span class=""><font color="#888888"><div><br></div><div>-- Andrew Gibiansky</div></font></span></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" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div></div>