linear-base icon indicating copy to clipboard operation
linear-base copied to clipboard

Ambiguous occurrence Generically when building with GHC 9.4

Open Bodigrim opened this issue 2 years ago • 2 comments

Describe the bug linear-base-0.2.0 fails to build against GHC 9.4 alpha 1, because GHC.Generics now exports Generically.

To Reproduce

cabal unpack linear-base-0.2.0
cd linear-base-0.2.0
cabal build -w ghc-9.4.0.20220501 --allow-newer
src/Data/Unrestricted/Linear/Internal/Consumable.hs:76:3: error:
    Ambiguous occurrence ‘Generically’
    It could refer to
       either ‘Generics.Linear.Generically’,
              imported from ‘Generics.Linear’ at src/Data/Unrestricted/Linear/Internal/Consumable.hs:39:1-22
              (and originally defined in ‘GHC.Generics’)
           or ‘Prelude.Linear.Generically.Generically’,
              imported from ‘Prelude.Linear.Generically’ at src/Data/Unrestricted/Linear/Internal/Consumable.hs:40:1-33
              (and originally defined
                 at src/Prelude/Linear/Generically.hs:16:1-37)
   |
76 |   Generically Prelude.Char
   |

Expected behavior Expected a successful build.

Bodigrim avatar May 20 '22 22:05 Bodigrim

Thanks @Bodigrim .

I hadn't tried, but let's just say that I'm not surprised. I was sort of expecting this to happen even. I'm not 100% sure how best to make a version which is compatible with both GHC 9.2 and GHC 9.4 yet. (I've been having issues with just being compatible with GHC 9.2, see #414 )

My favoured plan is to make two files which export Generically, one that defines it, and one that re-exports base's one. Build with the former in GHC 9.2 and with the latter in GHC 9.4.

aspiwack avatar May 23 '22 07:05 aspiwack

All that being said, I'm a bit swamped right now, so I'll be slow to implement any solution.

aspiwack avatar May 23 '22 07:05 aspiwack

There's an additional issue here when building with 9.4:

    • The ‘~’ operator is out of scope.
      Assuming it to stand for an equality constraint.
    • NB: ‘~’ used to be built-in syntax but now is a regular type operator
          exported from Data.Type.Equality and Prelude.
      If you are using a custom Prelude, consider re-exporting it.
    • This will become an error in a future GHC release.
    |
157 |     n ~ Arity b f
    |       ^

The recommendation from here appears to fix it:

module Prelude.Linear.Internal
  ( module Prelude.Linear.Internal
  , module Data.Type.Equality
  ) where

jeicher avatar Aug 25 '22 12:08 jeicher

I think this proposal would be the reason.

aspiwack avatar Aug 25 '22 12:08 aspiwack

Yeah, thanks. Just updated the previous comment :)

jeicher avatar Aug 25 '22 12:08 jeicher

https://hackage.haskell.org/package/generically ?

L-as avatar Sep 12 '22 11:09 L-as

Don't we always want our own version?

treeowl avatar Sep 12 '22 13:09 treeowl

I didn't know about the generically package, thanks for point it out @L-as. It would have worked, but we ended up deploying our own version. in #427 . This issue should have been closed (I'll close it now), but we mistakenly didn't.

I'll release very soon, I just need a couple of hours of focus time to push a few PRs and make the release.

aspiwack avatar Oct 03 '22 09:10 aspiwack

I am still getting issues with the dep tasty-hedgehog being marked as broken when testing this on ghc 9.4 using nix (probably out of scope), maybe a hackage release with different bounds can help though?

danwdart avatar Oct 10 '22 09:10 danwdart