Records in Haskell
Barney Hilken
b.hilken at ntlworld.com
Thu Sep 15 15:03:41 CEST 2011
As formulated on the wiki page, the "narrow issue" is a problem without a good solution. The reason the community rejected TDNR is because it's basically polymorphism done wrong. Since we already have polymorphism done right, why would we want it?
The right way to deal with records is first to agree a mechanism for writing a context which means
"a is a datatype with a field named n of type b"
then give the selector n the type
"a is a datatype with a field named n of type b" => n :: a -> b
There is no reason why this shouldn't be used with the current syntax (although it might clash with more advanced features like first-class labels).
Barney.
More information about the Glasgow-haskell-users
mailing list