Records in Haskell

Isaac Dupree ml at
Sat Feb 25 22:09:58 CET 2012

On 02/25/2012 10:18 AM, Gábor Lehel wrote:
>> This seems to me a much simpler approach than building the mechanism in to the language as DORF does, and it's also more general, because it isn't hard linked to the module system. Does it have any disadvantages?
> I can't tell offhand whether it has any drawbacks with respect to
> expressiveness. It seems to be a good solution to the stated problem,
> so thank you for proposing it.
> My objection is that I'm not sure if there is ever a case where "you
> really want things to be polymorphic over all records". There is
> nothing (as far as I know) analogous to this kind of implicit
> name-based polymorphism anywhere in Haskell. [...]

True enough.  But DORF doesn't, IMHO, really solve this concern.  If you 
choose to use DORF, then your PersonalName and BrandNames will still be 
overloaded in just the way you don't want.  The only way to avoid this 
is a pretty arbitrary stylistic decision whether to use Haskell98-style 
field-name-prefixes or use new-style overloading.

Even SORF is better than, say, C++ overloading in the sense that adding 
another overload in SORF cannot cause code not to compile, nor change 
its behaviour.

Convince me otherwise.


More information about the Glasgow-haskell-users mailing list