Proposal: ArgumentDo

Akio Takano tkn.akio at
Mon Jul 11 02:06:18 UTC 2016

Hi Henrik,

On 9 July 2016 at 09:46, Henrik Nilsson <Henrik.Nilsson at> wrote:
> Hi all,
> On 07/09/2016 08:09 AM, C Maeder wrote:
>> The asymmetry that you mention is already apparent for (Haskell98) infix
>> expressions, i.e. when "composing" lambda- or if-expression:
>>   (if c then f else g) . \ x -> h x
>> Parentheses around the last argument of "." do not matter, but
>> parentheses around the first argument make a real difference
> But that has to do with how grammatical ambiguity related to
> in this case "if" and "lambda" are resolved by letting
> the constructs extend as far as possible to the right.
> This the standard way of resolving that kind of ambiguity
> across a very wide range of programming languages and parsing
> tools (e.g. preferring shift over reduce in an LR parser).
> (And also in principle how lexical ambiguities are typically
> resolved, sometimes referred to as the "maximal munch rule".)
> In contrast, the present proposal suggests treating
> different argument positions in grammatically
> different ways (different non-terminals). As far as I know,
> that is unprecedented. And in any case, it manifestly
> complicates the grammar (more non-terminals) and as
> a consequence adds another grammatical hurdle to
> learning the language.

Thank you for pointing this out. I have updated the proposal so that
it doesn't introduce a new non-terminal.

I'm not sure if it should be implemented this way in the GHC parser,
but this is probably a separate question.

- Akio

More information about the Glasgow-haskell-users mailing list