Proposal: ArgumentDo

Joachim Breitner mail at joachim-breitner.de
Fri Jul 8 07:09:51 UTC 2016


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

-- 

Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- 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: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20160708/52f5f520/attachment.sig>


More information about the Glasgow-haskell-users mailing list