Updating records haskell
A prototype implementation, that works in GHC 7.6.3, shows how the classes are defined and gives examples of the instances that will be generated by GHC.Keep an eye out for the extension to land in GHC HEAD later this year, and please try it out and give your feedback!I'm very grateful to Simon Peyton Jones for acting as mentor for this project and as my guide to the GHC codebase.If a module does not export a field, clients of that module cannot use the can be used at two different record types, and the typechecker will figure out which type is meant, just like any other polymorphic function.
Similarly, functions can be polymorphic in the record type: extension does not attempt to generalise this syntax, so a record update expression will always refer to a single datatype, and if the field names do not determine the type uniquely, a type signature may be required. The type family is used so that the field type is a function of the data type and field name, which improves type inference.
However, it should land in HEAD soon after the 7.8 release is cut, so the adventurous are encouraged to build GHC and try it out.