Proposal: ArgumentDo

C Maeder chr.maeder at web.de
Fri Jul 8 09:20:53 UTC 2016


Surely layout can bite you:

  f
  do
  x
  do
  y

and I'm having difficulties to find the documentation for the various
layout options.

But this is no argument against this proposal!

Improper use of white spaces can always be used to obfuscate code!
Style guides are important. Furthermore, a wrong/unintended parse tree
(due to layout) will - in many cases - result in a typing error.

Christian

Am 08.07.2016 um 09:09 schrieb Joachim Breitner:
> Hi,
> 
> Am Freitag, den 08.07.2016, 08:35 +0200 schrieb Sven Panne:
>>    foobar
>>       do f &&& g
>>       x
>>
>> Should the x now be an argument of foobar (as it is currently) or the
>> "do"? If it is not an argument of the "do", suddenly things get very
>> context-dependent. Computers are good at handling context-dependent
>> things, humans are quite bad at it.
> 
> What do you mean by “as it is currently”. Currently, this is a syntax
> error! (“parse error on input ‘do’”).
> 
> Only with the proposed addition, it becomes an argument to foobar.
> 
> And it is not hard to reason about this: "x" is lined up with the "do",
> so it is a sibling, not a child, in the AST. Hence, both are arguments
> to foobar.
> 
> This is another good instance of how the (by me) beloved feature of
> “parenthesless arguments”, which so far is only available for the last
> argument of a function (using the “$” idiom), would now be possible for
> every argument of a function.
> 
> Greetings,
> Joachim
> 
> 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
> 



More information about the Glasgow-haskell-users mailing list