[Haskell-cafe] Ambiguous occurence error, despite use of DuplicateRecordFields (worked with ghc 8.10.7, not with 9.6.4)

Han Joosten han.joosten.han at gmail.com
Tue Apr 9 10:18:14 UTC 2024


Hi all,

I am currently migrating a Haskell project that uses ghc 8.10.7 to ghc
9.6.4.

Using the new version, I get errors like

~~~.haskell
Ambiguous occurrence ‘pos’
It could refer to
   either the field ‘pos’ of record ‘PClassify’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:1265:5
       or the field ‘pos’ of record ‘PPurpose’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:1186:5
       or the field ‘pos’ of record ‘P_ViewSegment’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:1129:5
       or the field ‘pos’ of record ‘P_ViewD’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:1080:5
       or the field ‘pos’ of record ‘P_IdentDf’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:1024:5
       or the field ‘pos’ of record ‘P_BoxItem’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:981:9
       or the field ‘pos’ of record ‘TemplateKeyValue’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:959:5
       or the field ‘pos’ of record ‘BoxHeader’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:947:5
       or the field ‘pos’ of record ‘P_SubIfc’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:934:9
       or the field ‘pos’ of record ‘P_Interface’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:899:5
       or the field ‘pos’ of record ‘P_Population’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:870:9
       or the field ‘pos’ of record ‘P_Rule’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:806:5
       or the field ‘pos’ of record ‘PairViewSegment’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:740:9
       or the field ‘pos’ of record ‘P_NamedRel’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:591:5
       or the field ‘pos’ of record ‘PAtomPair’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:467:5
       or the field ‘pos’ of record ‘Pragma’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:415:5
       or the field ‘pos’ of record ‘P_Relation’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:408:5
       or the field ‘pos’ of record ‘Representation’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:339:5
       or the field ‘pos’ of record ‘PConceptDef’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:268:5
       or the field ‘pos’ of record ‘P_Pattern’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:209:5
       or the field ‘pos’ of record ‘Role’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:185:5
       or the field ‘pos’ of record ‘P_RoleRule’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:172:5
       or the field ‘pos’ of record ‘P_Enforce’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:152:5
       or the field ‘pos’ of record ‘MetaData’,
          defined at
/workspaces/AmpersandNamespace/src/Ampersand/Core/ParseTree.hs:136:5

Previously, it was totally fine to have different data types each have a
field with the same name, as long as you used `DuplicateRecordFields`

I have searched the migration documentation but I couldn't find any clue on
why this has been changed or how to deal with it. I probably missed it.
Any help is mostly appreciated!

Thanks for reading
Cheers,
Han Joosten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20240409/374c91cd/attachment.html>


More information about the Haskell-Cafe mailing list