commercialhaskell / stackage

Stable Haskell package sets: vetted consistent packages from Hackage
https://www.stackage.org/
MIT License
530 stars 805 forks source link

crackNum fails to build with newer sbv #7575

Closed mihaimaruseac closed 6 days ago

mihaimaruseac commented 1 week ago
Preprocessing executable 'crackNum' for crackNum-3.14..                                                                                                                                                      
       Building executable 'crackNum' for crackNum-3.14..
       [3 of 3] Compiling Main [Data.SBV package changed]

       /home/curators/work/unpack-dir/unpacked/crackNum-3.14-407180036aaabd70fe2c8cf43e2934f6b93e407010eac998dccb0b3fc85193be/src/CrackNum/Main.hs:562:40: error: [GHC-39999]
           • Ambiguous type variable ‘a1’ arising from a use of ‘.==’
             prevents the constraint ‘(SymVal a1)’ from being solved.
             Probable fix: use a type annotation to specify what ‘a1’ should be.
             Potentially matching instances:
               instance (SymVal a, SymVal b) => SymVal (Either a b)
                 -- Defined in ‘sbv-11.0:Data.SBV.Core.Model’
               instance SymVal Int16 -- Defined in ‘sbv-11.0:Data.SBV.Core.Model’
               ...plus 30 others
               (use -fprint-potential-instances to see them all)
           • In the second argument of ‘($)’, namely ‘SBV x .== v’
             In a stmt of a 'do' block: pure $ SBV x .== v
             In the expression:
               do let k = KBounded sgn n
                      v = SBV $ SVal k $ Left $ mkConstCV k iv
                  x <- (if sgn then sIntN else sWordN) n "ENCODED"
                  pure $ SBV x .== v
           |
       562 |                           pure $ SBV x .== v
           |                                        ^^^

Placing an upper bound on sbv for now for a few weeks, per https://github.com/commercialhaskell/stackage/issues/7568#issuecomment-2461288085

CC @LeventErkok

LeventErkok commented 1 week ago

@mihaimaruseac Which version of GHC are you using for this?

Because with GHC9.10.1, I can compile it just fine against the latest SBV (v11) without any issues.

mihaimaruseac commented 6 days ago

This is stackage nightly, which uses ghc 9.8.3: https://www.stackage.org/nightly-2024-11-08

LeventErkok commented 6 days ago

I don't have a ghc 9.8.3 setup to try this out; so I guess this one won't make it to stackage. Oh well.

mihaimaruseac commented 6 days ago

LTS is currently on 9.6.6. The next LTS will start from nightly at the time we start it (probably on 9.8.4?).

Will likely have to do similar bounds for LTS

LeventErkok commented 6 days ago

Guess all I'm saying is I won't be uploading a new crackNum to make this problem go away.. How Stackage deals with that, I'm not sure.

phadej commented 6 days ago

@LeventErkok you can ghcup install ghc 9.8.2 (9.8.3 is not in ghcup yet) and cabal build -w ghc-9.8.2.

That said, I can also reproduce this issue on GHC-9.10.1:

crackNum-3.14 % cabal build -w ghc-9.10.1
Resolving dependencies...
Build profile: -w ghc-9.10.1 -O1
In order, the following will be built (use -v for more details):
 - crackNum-3.14 (exe:crackNum) (first run)
Configuring executable 'crackNum' for crackNum-3.14..
Preprocessing executable 'crackNum' for crackNum-3.14..
Building executable 'crackNum' for crackNum-3.14..
[1 of 3] Compiling CrackNum.TestSuite ( src/CrackNum/TestSuite.hs, /codetmp/crackNum-3.14/dist-newstyle/build/x86_64-linux/ghc-9.10.1/crackNum-3.14/x/crackNum/build/crackNum/crackNum-tmp/CrackNum/TestSuite.o )
[2 of 3] Compiling Paths_crackNum   ( /codetmp/crackNum-3.14/dist-newstyle/build/x86_64-linux/ghc-9.10.1/crackNum-3.14/x/crackNum/build/crackNum/autogen/Paths_crackNum.hs, /codetmp/crackNum-3.14/dist-newstyle/build/x86_64-linux/ghc-9.10.1/crackNum-3.14/x/crackNum/build/crackNum/crackNum-tmp/Paths_crackNum.o )
[3 of 3] Compiling Main             ( src/CrackNum/Main.hs, /codetmp/crackNum-3.14/dist-newstyle/build/x86_64-linux/ghc-9.10.1/crackNum-3.14/x/crackNum/build/crackNum/crackNum-tmp/Main.o )
src/CrackNum/Main.hs:562:40: error: [GHC-39999]
    • Ambiguous type variable ‘a1’ arising from a use of ‘.==’
      prevents the constraint ‘(SymVal a1)’ from being solved.
      Probable fix: use a type annotation to specify what ‘a1’ should be.
      Potentially matching instances:
        instance (SymVal a, SymVal b) => SymVal (Either a b)
          -- Defined in ‘sbv-11.0:Data.SBV.Core.Model’
        instance SymVal Int16 -- Defined in ‘sbv-11.0:Data.SBV.Core.Model’
        ...plus 30 others
        (use -fprint-potential-instances to see them all)
    • In the second argument of ‘($)’, namely ‘SBV x .== v’
      In a stmt of a 'do' block: pure $ SBV x .== v
      In the expression:
        do let k = KBounded sgn n
               v = SBV $ SVal k $ Left $ mkConstCV k iv
           x <- (if sgn then sIntN else sWordN) n "ENCODED"
           pure $ SBV x .== v
    |
562 |                           pure $ SBV x .== v
    |                                        ^^^

built against sbv-0.11, libBF-0.6.8

phadej commented 6 days ago

FWIW, I also noticed that some sbv version have incorrect lower bound on base, e.g. 10.12 with ghc-9.2.8:

Data/SBV/Core/Model.hs:64:1: error: [-Wdodgy-imports, -Werror=dodgy-imports]
    Module ‘GHC.TypeLits’ does not export ‘SChar’
   |
64 | import GHC.TypeLits hiding (SChar)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'll make revisions later today.

LeventErkok commented 6 days ago

I can’t replicate the failure with GHC 9.10.1, SBV 11.0 and CrackNum 3.14. Compiles just fine on my Mac.

I’m at a loss to how to debug this.

LeventErkok commented 6 days ago

Oh, never mind.. I blew-up my cabal cache and did a rebuild and can now see the failure. My installation must've gotten to a bizarre state.

I'll push a fix soon. Sorry about the noise.

LeventErkok commented 6 days ago

CrackNum 3.15 is now on Hackage: https://hackage.haskell.org/package/crackNum-3.15

It should compile cleanly with SBV 11.0

mihaimaruseac commented 6 days ago

Thank you