[Haskell-cafe] records proposals list

Bulat Ziganshin bulatz at HotPOP.com
Sat Nov 19 11:35:33 EST 2005

Hello David,

Saturday, November 19, 2005, 4:57:09 PM, you wrote:

DR> I'd benefit from just a list of problems that the record proposals want to
DR> solve.

DR> 1. The field namespace issue.
DR> 2. Multi-constructor getters, ideally as a function.
DR> 3. "Safe" getters for multi-constructor data types.
DR> 4. Getters for multiple data types with a common field.
DR> 5. Setters as functions.
DR> 6. Anonymous records.
DR> 7. Unordered records.

DR> Argh.  When I think about records too long I get dizzy.

really you are wrote solutions for all these problems (except 6), and
it's just an additional syntax sugar (like the fields itself). for
beginning, we must split this list to two parts: belonging to static
(like H98) and dynamic (anonymous) records. items in your list (except
6) belongs to static ones. dynamic records is whole different beast
and it's really hard to master, so the first question will be:

"are we wanna to have in Haskell only static records, only dynamic
records or both?"

as i see, GHC team want to implement such proposal, which will resolve
both issues. and wainting (waiting+wanting:) for such solution, they
are don't implement suggestions which address only static records

but the dynamic records is too complex thing: it may be syntactically
incompatible with H98, it may require changes to GHC internals and so
on, so they are delayed until better times

besides this all, i want to add one more item to your list:

7. OOP-like fields inheritance:

data Coord = { x,y :: Double }
data Point : Coord = { c :: Color }

of course this is just another sort of syntax sugar once we start
using classes to define getter/setter functions

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list