Proposal: ArgumentDo

Joachim Breitner mail at
Fri Jul 8 07:09:51 UTC 2016


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.



Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  XMPP: nomeata at • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Glasgow-haskell-users mailing list