Skip to content

Commit 02e2de5

Browse files
wz1000mergify[bot]
andauthored
Various strictness improvements (#3413)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 686fa1a commit 02e2de5

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

+2-14
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ loadModulesHome
986986
-> HscEnv
987987
loadModulesHome mod_infos e =
988988
#if MIN_VERSION_ghc(9,3,0)
989-
hscUpdateHUG (\hug -> foldr addHomeModInfoToHug hug mod_infos) (e { hsc_type_env_vars = emptyKnotVars })
989+
hscUpdateHUG (\hug -> foldl' (flip addHomeModInfoToHug) hug mod_infos) (e { hsc_type_env_vars = emptyKnotVars })
990990
#else
991991
let !new_modules = addListToHpt (hsc_HPT e) [(mod_name x, x) | x <- mod_infos]
992992
in e { hsc_HPT = new_modules
@@ -1454,18 +1454,6 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
14541454

14551455
case (mb_checked_iface, recomp_iface_reqd) of
14561456
(Just iface, UpToDate) -> do
1457-
-- If we have an old value, just return it
1458-
case old_value of
1459-
Just (old_hir, _)
1460-
| isNothing linkableNeeded || isJust (hirCoreFp old_hir)
1461-
-> do
1462-
-- Perform the fine grained recompilation check for TH
1463-
maybe_recomp <- checkLinkableDependencies get_linkable_hashes (hsc_mod_graph sessionWithMsDynFlags) (hirRuntimeModules old_hir)
1464-
case maybe_recomp of
1465-
Just msg -> do_regenerate msg
1466-
Nothing -> return ([], Just old_hir)
1467-
-- Otherwise use the value from disk, provided the core file is up to date if required
1468-
_ -> do
14691457
details <- liftIO $ mkDetailsFromIface sessionWithMsDynFlags iface
14701458
-- parse the runtime dependencies from the annotations
14711459
let runtime_deps
@@ -1552,7 +1540,7 @@ showReason (RecompBecause s) = s
15521540
mkDetailsFromIface :: HscEnv -> ModIface -> IO ModDetails
15531541
mkDetailsFromIface session iface = do
15541542
fixIO $ \details -> do
1555-
let hsc' = hscUpdateHPT (\hpt -> addToHpt hpt (moduleName $ mi_module iface) (HomeModInfo iface details Nothing)) session
1543+
let !hsc' = hscUpdateHPT (\hpt -> addToHpt hpt (moduleName $ mi_module iface) (HomeModInfo iface details Nothing)) session
15561544
initIfaceLoad hsc' (typecheckIface iface)
15571545

15581546
coreFileToCgGuts :: HscEnv -> ModIface -> ModDetails -> CoreFile -> IO CgGuts

ghcide/src/Development/IDE/GHC/Compat.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ getModuleHash = mi_mod_hash . mi_final_exts
503503

504504
disableWarningsAsErrors :: DynFlags -> DynFlags
505505
disableWarningsAsErrors df =
506-
flip gopt_unset Opt_WarnIsError $ foldl' wopt_unset_fatal df [toEnum 0 ..]
506+
flip gopt_unset Opt_WarnIsError $! foldl' wopt_unset_fatal df [toEnum 0 ..]
507507

508508
isQualifiedImport :: ImportDecl a -> Bool
509509
isQualifiedImport ImportDecl{ideclQualified = NotQualified} = False

ghcide/src/Development/IDE/Types/Action.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ abortQueue :: DelayedActionInternal -> ActionQueue -> STM ()
6969
abortQueue x ActionQueue {..} = do
7070
qq <- flushTQueue newActions
7171
mapM_ (writeTQueue newActions) (filter (/= x) qq)
72-
modifyTVar inProgress (Set.delete x)
72+
modifyTVar' inProgress (Set.delete x)
7373

7474
-- | Mark an action as complete when called after 'popQueue'.
7575
-- Has no effect otherwise
7676
doneQueue :: DelayedActionInternal -> ActionQueue -> STM ()
7777
doneQueue x ActionQueue {..} = do
78-
modifyTVar inProgress (Set.delete x)
78+
modifyTVar' inProgress (Set.delete x)
7979

8080
countQueue :: ActionQueue -> STM Natural
8181
countQueue ActionQueue{..} = do

plugins/hls-class-plugin/src/Ide/Plugin/Class/Types.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{-# LANGUAGE LambdaCase #-}
55
{-# LANGUAGE TypeFamilies #-}
66
{-# LANGUAGE ViewPatterns #-}
7+
{-# LANGUAGE BangPatterns #-}
78

89
module Ide.Plugin.Class.Types where
910

@@ -45,7 +46,7 @@ data GetInstanceBindTypeSigs = GetInstanceBindTypeSigs
4546

4647
data InstanceBindTypeSig = InstanceBindTypeSig
4748
{ bindName :: Name
48-
, bindRendered :: T.Text
49+
, bindRendered :: !T.Text
4950
, bindDefSpan :: Maybe SrcSpan
5051
-- ^SrcSpan for the bind definition
5152
}

0 commit comments

Comments
 (0)