
Il giorno 04/ott/2014, alle ore 20:02, Andrew Gibiansky
Nicola,
Could you be looking for the OverloadedRecordFields[0] extension? This is an extension that I think is slated to be in 7.10, and might do what you want (though won't help you now).
If you declare two data types with the same field name (e.g. data A = A { hello :: Int} and data B = B { hello :: Int }), the extension will generate some typeclasses and type families so that you can use `hello` on both data types.
(I haven't used this myself, but have been looking forward to it, so if anyone wants to correct me on anything I've said please do so.)
[0] https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields
Yes, that extension would be exactly what I want. When GHC 7.10 comes out I’ll use it for sure! In the meantime I hoped there was a package to overcome this but as Dan has said, it seems it doesn’t exist. Thank you everybody for all the answers. Greetings, Nicola