Why not allow empty record updates?
Simon Peyton-Jones
simonpj at microsoft.com
Tue Nov 15 16:50:59 CET 2011
Hmm yes. Fair enough. Does anyone care enough? I can see (now) that it wouldn't really be hard.
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Yitzchak Gale
| Sent: 15 November 2011 11:16
| To: Malcolm Wallace
| Cc: GHC-users List
| Subject: Re: Why not allow empty record updates?
|
| Simon Peyton-Jones wrote:
| >> Trouble is, what type does this have?
| >> f x = x {}
|
| Malcolm Wallace wrote:
| > Empty record patterns {} are permitted, even for types
| > that are not declared with named fields.
| > So I don't see why an empty record update should
| > require the type to be declared with named fields either.
|
| Yes. The translation of record updates given in the Report
| makes perfect sense for {}. It is only forbidden by
| "n >= 1", but no reason is given for that restriction.
|
| According to that translation, the type of x {} is
| the type of the case expression it translates to.
|
| Thanks,
| Yitz
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list