haskell / happy

The Happy parser generator for Haskell
Other
291 stars 84 forks source link

Support Cabal 3.0, 3.2 #312

Closed sgraf812 closed 2 months ago

sgraf812 commented 2 months ago

Fixes #311.

leonschoorl commented 2 months ago

I was hoping this might be fixed on hackage with a revision.

But looking at the Hackage Metadata Revisions FAQ it seems you can't change the Cabal spec version outside of very specific range.

And even if you could, the resolver probably isn't smart enough to conclude it can't build any version of happy-lib and then try instead to build an older version of happy, from before happy-lib was split off.

sgraf812 commented 2 months ago

I'm cutting a release for happy-lib-2.0.2 anyway because of #309. Furthermore, I have now deprecated versions 2.0 and 2.0.1 of happy-lib. Does that help?

leonschoorl commented 2 months ago

I now suspect it won't. I'm not knowledgeable enough about cabal to be sure.

leonschoorl commented 2 months ago

I could get cabal-3.2 to build happy by removing all happy-lib: prefixes from the happy-lib.cabal file. And making sure it starts with cabal-version: 3.0, not 3.4.

sgraf812 commented 2 months ago

Interesting. Can you try whether the just amended PR works?

leonschoorl commented 2 months ago

You missed these two:

index 44381cb..209fac8 100644
--- a/lib/happy-lib.cabal
+++ b/lib/happy-lib.cabal
@@ -87,7 +87,7 @@ library frontend
                        Happy.Frontend.AbsSyn,
                        Happy.Frontend.Mangler,
                        Happy.Frontend.PrettyGrammar
-  build-depends:       base < 5, array, transformers, containers, mtl, happy-lib:grammar
+  build-depends:       base < 5, array, transformers, containers, mtl, grammar
   other-modules:
         Happy.Frontend.ParseMonad
         Happy.Frontend.ParseMonad.Class
@@ -107,7 +107,7 @@ library tabular
                        Happy.Tabular.Info,
                        Happy.Tabular.LALR,
                        Happy.Tabular.NameSet
-  build-depends:       base < 5, array, containers, happy-lib:grammar
+  build-depends:       base < 5, array, containers, grammar

 library backend-lalr

But if you remove them too, then it works. The testsuite even passes.

sgraf812 commented 2 months ago

Thanks! Will release 2.0.2 with the fix soon.