Records in Haskell

Simon Peyton-Jones simonpj at microsoft.com
Tue Jan 17 08:40:14 CET 2012


Yitz: very helpful.  Can you turn your proposal into a Wiki page?  It's different to Johan's.

Could you add examples?  I don't fully understand your design.


| [This has the additional advantage of giving SPJ
| motivation to remain engaged, because he seems
| to prefer B. :)]

True: but that's because I think that in the end A will be deemed too clumsy, so we'll end with B anyway. And I'd rather not do both.  But I'm quite open to persuasion!

| Proposal for A:
...
| When a module M.A is directly nested in module M, there is
| an implied import in the enclosing module M as follows:
| 
| import qualified M.A as A

OK, so consider this:

	module M where
   	  module T where
	    data T = MkT { x :: Int }
	  module S where
	    data S = MkS { x :: Int }

So inside M I can refer to T.x and S.x.  Fine!  What does M export? The current rules say that it cannot export two things both called "x". So this program will be rejected.  But that is obviously not what you want.

Simon




More information about the Glasgow-haskell-users mailing list