Pattern matching order for records

Hi all, 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. Personally I actually think hugs is doing the right thing according to the report and that there is no real ambiguity in the report's language, just a bit of unclarity. Furthermore, I think hugs' interpretation means that it is easier for the programmer to understand how his program will behave if he only has to look at the pattern to be matched, and not refer back to the definition of the record, even if this does make for slightly more desugaring work for the implementor. Thus I would propose just clarifying the language for Haskell'. Thanks Ian

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

On Fri, Oct 13, 2006 at 05:19:09PM +0100, Malcolm Wallace wrote:
Ian Lynagh
wrote: 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?
Ooops, missed that. Sorry for the noise! Ian
participants (2)
-
Ian Lynagh
-
Malcolm Wallace