patch applied (haskell-prime-status): BangPatterns: probably accept ==> undecided

Simon Peyton-Jones simonpj at microsoft.com
Fri Apr 18 03:36:42 EDT 2008


| > >  In the list of features "required for Haskell in practice", bang patterns are
| > >  way up there.
| >
| > But their syntax has issues:
| >
| > a!b = ...
| >
| > Did I just define the function "a" or the function "!"?
|
| Interesting note, if we solve this, then we can apply the same thing to
| the treatment of ~ and regain it as a usable operator.

In GHC I implemented a pretty grotesque hack.  I really really wanted

        f !x !y = e

to work as you'd expect.  But because of the infix operator thing, that parses as

        (f ! x) ! y = e

A gruesome post-processing step restores the parse we want, for the special case of !.  It's not nice, but I didn't have the luxury of changing anything else, which we do now.

Not allowing infix functions on the LHS would be a notable simplification.  Constructors in patterns should still be infix of course:
        f (a :=: b) = ...


In any case, I've always thought this was weird:
        Just x == Just y = x == y

Simon


More information about the Haskell-prime mailing list