Records (was Re: [Haskell] Improvements to GHC)

Tomasz Zielonka tomasz.zielonka at
Sun Nov 20 09:43:08 EST 2005

On Sun, Nov 20, 2005 at 08:54:35AM -0500, David Roundy wrote:
> As an aside, what's responsible for the insanity of pattern matching record
> fields being backwards? I'd bar = b to bind b to bar, not the other way
> around... why should record pattern matching use '=' in a manner opposite
> from the rest of Haskell?

It just mimics the way (record) values are constructed, as in all
pattern matching in Haskell. You can put a pattern variable everywhere
you could put a value in a corresponding constructing expression. For
example, all these "terms" can be used both as an expression and a
pattern. In the first case x, y, z are expressions, in the second they
are patterns.




    (C x y, D z)

    R { field1 = x, field2 = y, field3 = z }

I think this is very consistent.

Best regards

More information about the Haskell mailing list