On 15 September 2010 04:31, Jonathan Geddes <[email protected]> wrote:
> Wow, I had no idea there were so many record packages! This indicates a
> couple things to me: a) Haskell is very flexible. b) I'm not the only one
> who things the built-in record system isn't perfect.
> Digging a bit deeper, it looks like some of the record-related ghc
> extensions might also be useful, such as record punning and field
> disambiguation.
> Since these are already extensions, they're more likely to make it into
> Haskell 20XX. Are these considered to be the solution to current record
> syntax problems?
> With these extensions, couldn't I write the following?
>>someUpdate :: MyRecord -> MyRecord
>>someUpdate myRecord@(MyRecord{..}) = let
>> { field1 = f field1
>> , field2 = g field2
>> , field3 = h filed3
>> } in myRecord{..}
or just:
someUpdate :: MyRecord -> MyRecord
someUpdate myrec...@myrecord{..} =
myRecord{ field1 = f field1
, field2 = g field2
, field3 = h field3
}
Conrad.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe