Records in Haskell

AntC anthony_clayden at clear.net.nz
Thu Mar 1 10:18:45 CET 2012


J. Garrett Morris <jgmorris <at> cs.pdx.edu> writes:

> On Wed, Feb 29, 2012 at 11:58 PM, AntC <anthony_clayden <at> clear.net.nz> 
wrote:
> > SORF's whadyoumaycalls are at the Kind level. (I'm not opposed to them
> > because they're new-fangled, I'm opposed because I can't control the
> > namespace.)
> 
> Nah, they have kinds, and they don't take parameters, so they're
> probably types.  Whether you prefer that "foo" in module A mean the same
> thing as "foo" in module B is entirely up to you; ...
>  /g
> 

It's about representation hiding:
- I don't want the importer to even know I have field "foo",
- but they can use my field "bar"

Or perhaps:
- I don't want the importer to update field "foo"
- but they can read "foo", and they can update "bar"

(This is especially to support using records to emulate OO, where we want 
abstraction/'separation of concerns'.)

If the importer (either maliciously or by accident) creates their own record 
with a "foo" field, I specifically _don't_ want them to try sharing my 
hidden "foo".

AntC




More information about the Glasgow-haskell-users mailing list