summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Utils/Monad.hs
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-04-06 15:51:38 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-23 18:53:13 -0400
commitd82d38239f232c3970a8641bb6d47d436e3cbc11 (patch)
tree55b162143144486cddda1b2a2a7ca0b7eb373a1c /compiler/GHC/Tc/Utils/Monad.hs
parent82c6a9394b0457e77bc8b03e3594111b51508469 (diff)
downloadhaskell-d82d38239f232c3970a8641bb6d47d436e3cbc11.tar.gz
Introduce Strict.Maybe, Strict.Pair (#19156)
This patch fixes a space leak related to the use of Maybe in RealSrcSpan by introducing a strict variant of Maybe. In addition to that, it also introduces a strict pair and uses the newly introduced strict data types in a few other places (e.g. the lexer/parser state) to reduce allocations. Includes a regression test.
Diffstat (limited to 'compiler/GHC/Tc/Utils/Monad.hs')
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 2d9298e12b..e385322223 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -188,6 +188,7 @@ import GHC.Utils.Panic
import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Misc
import GHC.Utils.Logger
+import qualified GHC.Data.Strict as Strict
import GHC.Types.Error
import GHC.Types.Fixity.Env
@@ -896,7 +897,7 @@ addDependentFiles fs = do
getSrcSpanM :: TcRn SrcSpan
-- Avoid clash with Name.getSrcLoc
-getSrcSpanM = do { env <- getLclEnv; return (RealSrcSpan (tcl_loc env) Nothing) }
+getSrcSpanM = do { env <- getLclEnv; return (RealSrcSpan (tcl_loc env) Strict.Nothing) }
-- See Note [Error contexts in generated code]
inGeneratedCode :: TcRn Bool