[Haskell-cafe] record update

Jonathan Geddes geddes.jonathan at gmail.com
Tue Sep 14 15:31:09 EDT 2010

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
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{..}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100914/bd26edb6/attachment.html

More information about the Haskell-Cafe mailing list