On Sun, Nov 20, 2005 at 01:40:01PM +0100, Georg Martius wrote: > 7. Unordered records. > I don' t understand it.
It's just that I'd like to be able to write: data FooBar = FooBar { foo, bar :: String } such that you can't write let f = FooBar "a" "b" but instead are forced to write let f = FooBar { foo = "a", bar = "b" } More importantly when you pattern match, you couldn't write case f of FooBar _ b -> b but instead would have to write case f of FooBar { bar = b } -> b The reason being that I'd like to be able to export constructors from a module in such a way that I can later reorder or add or remove field from that record without breaking any pattern-matching code, and if I'm only reordering the fields, I shouldn't break any constructor code either. 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? -- David Roundy http://www.darcs.net
signature.asc
Description: Digital signature
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell