Bang patterns

Ian Lynagh ian at
Mon Feb 4 02:20:18 CET 2013

On Mon, Feb 04, 2013 at 12:44:53AM +0000, Ben Millwood wrote:
> I have two proposals, I suppose:
> - make bang patterns operate only on variables and wildcards
> - make bang patterns in let altogether invalid

Looking at this again made me realise that, as well as !_ and !varid
lexemes, we could also alter the decl production so that we get
    decl -> ...
          | pat rhs     -- existing lazy binding production
          | '!' pat rhs -- new strict binding production

That means that
    let !(x, y) = e in ...
would still be valid, with the ! not actually being parsed as part of
the pattern, but would parse instead as a strict binding. It would be
a little ugly under the hood, as
    let !x = e in ...
would parse as a lazy binding, although we'd want to treat it as a
strict binding anyway.


More information about the Haskell-prime mailing list