Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous occurrence ‘show’. #116

Closed
JanEricNitschke opened this issue Oct 29, 2024 · 10 comments
Closed

Ambiguous occurrence ‘show’. #116

JanEricNitschke opened this issue Oct 29, 2024 · 10 comments

Comments

@JanEricNitschke
Copy link

JanEricNitschke commented Oct 29, 2024

I was just trying to build a package that depends on hsfnotify and found that it fails with the following error:

Failed to build fsnotify-0.4.1.0.
Build log (
/home/runner/.cabal/logs/ghc-9.10.1/fsnotify-0.4.1.0-84e6eca68f95f5931bba224ddfed1052a0f3cea0afc70dce1734a917714d6197.log
):
Configuring library for fsnotify-0.4.1.0...
Preprocessing library for fsnotify-0.4.1.0...
Building library for fsnotify-0.4.1.0...
[1 of 8] Compiling System.FSNotify.Find ( src/System/FSNotify/Find.hs, dist/build/System/FSNotify/Find.o, dist/build/System/FSNotify/Find.dyn_o )
[2 of 8] Compiling System.FSNotify.Path ( src/System/FSNotify/Path.hs, dist/build/System/FSNotify/Path.o, dist/build/System/FSNotify/Path.dyn_o )
[3 of 8] Compiling System.FSNotify.Types ( src/System/FSNotify/Types.hs, dist/build/System/FSNotify/Types.o, dist/build/System/FSNotify/Types.dyn_o )
[4 of 8] Compiling System.FSNotify.Listener ( src/System/FSNotify/Listener.hs, dist/build/System/FSNotify/Listener.o, dist/build/System/FSNotify/Listener.dyn_o )
[5 of 8] Compiling System.FSNotify.Polling ( src/System/FSNotify/Polling.hs, dist/build/System/FSNotify/Polling.o, dist/build/System/FSNotify/Polling.dyn_o )
[6 of 8] Compiling System.FSNotify.Linux ( src/System/FSNotify/Linux.hs, dist/build/System/FSNotify/Linux.o, dist/build/System/FSNotify/Linux.dyn_o )
[7 of 8] Compiling System.FSNotify  ( src/System/FSNotify.hs, dist/build/System/FSNotify.o, dist/build/System/FSNotify.dyn_o )
src/System/FSNotify.hs:127:82: error: [GHC-87543]
Error:     Ambiguous occurrence ‘show’.
    It could refer to
       either ‘Prelude.show’,
              imported from ‘Prelude’ at src/System/FSNotify.hs:73:1-32
              (and originally defined in ‘ghc-internal-9.1001.0:GHC.Internal.Show’),
           or ‘T.show’,
              imported from ‘Data.Text’ at src/System/FSNotify.hs:80:1-21.
    |
127 | defaultOnHandlerException e = putStrLn ("fsnotify: handler threw exception: " <> show e)
    |                                                                                  ^^^^

Error: [Cabal-7125]

This seems to be due tot he addition of show in version 2.1.2 of text.

haskell/text#608
haskell/text#623

@thomasjm
Copy link
Contributor

Thanks, fixed. I was just working towards a new release so hopefully that'll be out soon.

@LaurentRDC
Copy link

Would you also be able to make a Hackage revision to pin text to <2.1.2?

@thomasjm
Copy link
Contributor

Done

@alexfmpe
Copy link
Contributor

alexfmpe commented Nov 10, 2024

Would you also be able to make a Hackage revision to pin text to <2.1.2?

Note this can cause build plans to pick fsnotify 0.4.0.1 because that one allows text 2.1.2 and then the build fails.
Increasing the lower bound on fsnotify solved it for me, but I wonder if it can be fixed upstream with more revisions.

@JanEricNitschke
Copy link
Author

Yeah, my CI ist still failing because it picks the old version that has neither the restriction nor fix as a transient dependency.

Best would probably to publish a new proper release that includes the actual fix.

@alexfmpe
Copy link
Contributor

Best would probably to publish a new proper release that includes the actual fix.

Problem is this alone doesn't seem to fix the problem as cabal solver might pick a newer text over a newer fsnotify. The issue is that older versions also don't work with newer text so those need a revision.

@JanEricNitschke
Copy link
Author

But the version on main (which would be the newest fsnotify) is compatible with the newest text version.

@alexfmpe
Copy link
Contributor

Ah true. I was thinking main could have more restricted bounds than 0.4.0.1 on libraries other than text but that doesn't seem to be the case

@georgefst
Copy link

The issue is that older versions also don't work with newer text so those need a revision.

This is very much an issue. If you're going to not have upper bounds on dependencies, then it's necessary to bulk-revise older versions when something like this happens. This can be partially automated with https://hackage.haskell.org/package/hackage-cli.

@thomasjm
Copy link
Contributor

thomasjm commented Dec 3, 2024

Okay, I revised all versions with the upper bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants