From f936185cc08af016876672145b4b30b893840732 Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 13 Sep 2024 10:42:00 +0200 Subject: [PATCH] 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 ]