Overloaded record fields

AntC anthony_clayden at clear.net.nz
Thu Jun 27 13:43:43 CEST 2013


> Adam Gundry <adam.gundry <at> strath.ac.uk> writes:
>
> I've started to document the plan on the GHC wiki:
> 
http://hackage.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/Pla
n
> 

Thank you Adam, (Simon)

I like the approach for Representation hiding. (That was something I was 
particularly trying to preserve out of H98 records.)

At first I was worried this would involve 'scoped' instances -- which 
seems a wild departure.

But I see in the 'Multiple modules' section that you're generating 
instances on-the-fly. So I agree that option (2) looks best.

As I understand it, this means that the extensions switched on in the 
importing module is all we have to worry about, not what extensions 
applied where the data type is declared.

So for backward compatibility, I can import historic Library L ( R(x) ) 
which knows nothing about the new stuff. And in my module (with the 
extension on) declare data type T with field x, and not have a clash of 
field names.

Sweet!







More information about the Glasgow-haskell-users mailing list