Suggestion for bang patterns documentation

Simon Peyton-Jones simonpj at microsoft.com
Fri Feb 27 06:22:49 EST 2009


| <cite>
| The let-binding can be recursive. However, it is much more common for
| the let-binding to be non-recursive, in which case the following law
| holds: (let !p = rhs in body)  is equivalent to (case rhs of !p -> body)
| </cite>
|
| Shouldn't the bang be removed in the final case pattern?

No.  If p was a simple variable, then
        case rhs of x -> body
is non-strict in Haskell, but should be strict here.

| P.S. It should be mentioned that ~ and ! only make sense for single
| variant data types (like tuples)

That isn't true.  Both are useful for multi-variant types

Simon


More information about the Glasgow-haskell-users mailing list