
Ian Lynagh
Has clarifying the pattern matching order for records as described in http://hackage.haskell.org/trac/ghc/ticket/246 been discussed for haskell'? I couldn't see it on the proposals list.
Perhaps because this has already been fixed in the errata to the Haskell'98 Report? See http://haskell.org/definition/haskell98-revised-bugs.html Specifically: [July 2004] Page 32, Section 3.17.2, Informal Semantics of Pattern-Matching, case #6. Case 6 says: "Matching against a constructor using labeled fields is the same as matching ordinary constructor patterns except that the fields are matched in the order they are named in the field list. All fields listed must be declared by the constructor; fields may not be named more than once. Fields not named by the pattern are ignored (matched against _)." You could interpret 'field list' to mean the order the fields appear in the pattern, OR, the order in which the fields were declared. The choice of interpretation affects termination behaviour. The intention of the Report writers was to use the field order of the pattern, not the declaration. Thus, the Report can be clarified by changing the end of the first sentence above to read "the order they are named in the pattern field list". Regards, Malcolm