I'm using the DuplicateRecordFields (+OverloadedLabels) extension, and I've run into a situation where I can't figure out how to disambiguate in a record update.
Here is a simplified example:
data A = A { name :: String }
data B = B { name :: String }
combine :: A -> B -> A
combine a b = a { name = name b }
Is there any way to make this work?
I answered in one of the previous questions about
-XDuplicateRecordFields
that currently GHC doesn't infer type of record field from its argument:What you can do now is to specify type of
name
extractor explicitly, like this: