Records (was Re: [Haskell] Improvements to GHC)

Wolfgang Jeltsch wolfgang at jeltsch.net
Wed Nov 23 08:58:43 EST 2005


Am Mittwoch, 23. November 2005 14:22 schrieb David Roundy:
> On Tue, Nov 22, 2005 at 02:32:47PM +0000, Rob Ennals wrote:
> [...]

> > 7. Unordered records: yep (if I understand the problem correctly)
>
> I don't think you understood correctly.  What I'd like (and this is another
> one of those David-specific issues--I've never heard anyone else complain
> about this) is to be able to create a data type that has no order.  If I
> write
>
> data FooBar = FooBar { foo, bar :: String }
>
> I can construct this (either with Haskell 98 or with your proposal, as I
> understand it) with either
>
> fb = FooBar { foo = "a", bar = "b" }
>
> or with
>
> fb = FooBar "a" "b"
>
> I'd prefer to at least optionally be able to make the second syntax fail to
> compile--which is what I mean by an unordered record.  The same goes for
> pattern matching.

You can just omit the data constructors from the module's export list.

> [...]

Best wishes,
Wolfgang


More information about the Haskell mailing list