Proposal: ArgumentDo
C Maeder
chr.maeder at web.de
Wed Jul 6 16:08:09 UTC 2016
Hi,
allowing group A constructs (do, case, ...) and group B constructs (\,
let, if, ...) as parts of functions application (fexp) without extra
parentheses looks natural to me. The current state is an artificial and
unnecessary restriction. Style guides may dictate restrictions, but the
parser/language should not (without good reasons).
So +1 for the proposal from me.
However, I would not distinguish group A and group B constructs in the
proposed grammar rules. The report already states (for the group B
constructs):
"The grammar is ambiguous regarding the extent of lambda abstractions,
let expressions, and conditionals. The ambiguity is resolved by the
meta-rule that each of these constructs extends as far to the right as
possible."
Therefore I would simply add all constructs (that start with a unique
keyword) to atomic expressions (aexp) where the term "atomic" might be
misleading but is already accepted for the record constructs.
For the group B constructs this simply means that they can only be the
last argument (or the mere function itself) in any expression (exp). The
non-terminal lexp is no longer needed (and could be replaced by fexp in
infixexp).
Furthermore group B constructs are also delimited by the layout rules
(of decls).
Cheers Christian
Am 04.07.2016 um 12:31 schrieb Akio Takano:
> Hi glasgow-haskell-users,
>
> I have written a wiki page about a proposed extension called
> ArgumentDo. It's a small syntactic extension that allows "do"
> expressions, lambdas and a few other kinds of expressions to be used
> as function arguments, without parentheses.
>
> https://ghc.haskell.org/trac/ghc/wiki/ArgumentDo
>
> Any feedback is appreciated. In particular, since the idea has
> received mixed support (see the "Discussion" section on the wiki
> page), I'd like to make sure that there is enough support for this
> feature to justify an implementation in GHC.
>
> Regards,
> Takano Akio
> _______________________________________________
> 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