[Haskell-cafe] records proposals list

Benjamin Franksen benjamin.franksen at bessy.de
Sun Nov 20 07:02:37 EST 2005


On Saturday 19 November 2005 17:35, Bulat Ziganshin wrote:
> 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 problems
>
> 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

Please take a look at the recent paper by Daan Leijen 
(http://www.cs.uu.nl/~daan/pubs.html#scopedlabels). I think this would 
solve the mentioned problems and has the additional advantage of 
supporting anonymous records. The author claims his proposal to be 
integrable with most known type systems.

Ben


More information about the Haskell-Cafe mailing list