haskell-fswatch / hfsnotify

Unified Haskell interface for basic file system notifications
BSD 3-Clause "New" or "Revised" License
136 stars 40 forks source link

Ambiguous occurrence ‘show’. #116

Closed JanEricNitschke closed 2 weeks ago

JanEricNitschke commented 2 weeks ago

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.

https://github.com/haskell/text/pull/608 https://github.com/haskell/text/issues/623

thomasjm commented 2 weeks ago

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

LaurentRDC commented 2 weeks ago

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

thomasjm commented 2 weeks ago

Done

alexfmpe commented 3 days ago

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 commented 3 days ago

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 commented 3 days ago

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 commented 3 days ago

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

alexfmpe commented 3 days ago

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