From 62a265bc11b9f58f98483c2310ad5d11aaf9d895 Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 13 Sep 2024 10:42:00 +0200 Subject: [PATCH 1/2] Use -XNoStrictData in generated parser (#273) Fixes #273. --- ChangeLog.md | 4 ++++ packages/backend-lalr/src/Happy/Backend/LALR.hs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 192f6126..9670a566 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,10 @@ The main focus of this release was modularizing Happy. +* Generated parsers now activate the language extension `-XNoStrictData` without + which every use of a happy parser would lead to an immediate crash (#273). + This causes us to drop support for GHC < 8.0. + * Break up into libraries: - `happy-backend-glr` diff --git a/packages/backend-lalr/src/Happy/Backend/LALR.hs b/packages/backend-lalr/src/Happy/Backend/LALR.hs index ade8fe78..2e234202 100644 --- a/packages/backend-lalr/src/Happy/Backend/LALR.hs +++ b/packages/backend-lalr/src/Happy/Backend/LALR.hs @@ -35,7 +35,7 @@ importsToInject debug = concat ["\n", import_array, import_bits, import_glaexts, "import Control.Monad (ap)\n" langExtsToInject :: [String] -langExtsToInject = ["MagicHash", "BangPatterns", "TypeSynonymInstances", "FlexibleInstances"] +langExtsToInject = ["MagicHash", "BangPatterns", "TypeSynonymInstances", "FlexibleInstances", "NoStrictData"] defines :: Bool -> Bool -> String defines debug coerce = unlines [ "#define " ++ d ++ " 1" | d <- vars_to_define ] From c5a6328c4aebd9dc597af4b51b739da5b5046200 Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 13 Sep 2024 15:32:51 +0200 Subject: [PATCH 2/2] Bump lower bound on base to 4.9 --- happy.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/happy.cabal b/happy.cabal index f0326da6..cdafc096 100644 --- a/happy.cabal +++ b/happy.cabal @@ -140,7 +140,7 @@ executable happy hs-source-dirs: src main-is: Main.lhs - build-depends: base < 5, + build-depends: base >= 4.9 && < 5, array, containers >= 0.4.2, mtl >= 2.2.1, @@ -164,5 +164,5 @@ test-suite tests build-tools: happy ghc-options: -threaded - build-depends: base < 5, process < 1.7 + build-depends: base >= 4.9 && < 5, process < 1.7 default-language: Haskell98