Skip to content

Commit 3e20fc3

Browse files
committed
Various strictness improvements
1 parent f94385e commit 3e20fc3

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ loadModulesHome
991991
-> HscEnv
992992
loadModulesHome mod_infos e =
993993
#if MIN_VERSION_ghc(9,3,0)
994-
hscUpdateHUG (\hug -> foldr addHomeModInfoToHug hug mod_infos) (e { hsc_type_env_vars = emptyKnotVars })
994+
hscUpdateHUG (\hug -> foldl' (flip addHomeModInfoToHug) hug mod_infos) (e { hsc_type_env_vars = emptyKnotVars })
995995
#else
996996
let !new_modules = addListToHpt (hsc_HPT e) [(mod_name x, x) | x <- mod_infos]
997997
in e { hsc_HPT = new_modules
@@ -1455,18 +1455,6 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
14551455

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ getModuleHash = mi_mod_hash . mi_final_exts
513513

514514
disableWarningsAsErrors :: DynFlags -> DynFlags
515515
disableWarningsAsErrors df =
516-
flip gopt_unset Opt_WarnIsError $ foldl' wopt_unset_fatal df [toEnum 0 ..]
516+
flip gopt_unset Opt_WarnIsError $! foldl' wopt_unset_fatal df [toEnum 0 ..]
517517

518518
isQualifiedImport :: ImportDecl a -> Bool
519519
isQualifiedImport ImportDecl{ideclQualified = NotQualified} = False

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ fromIdentInfo doc id@IdentInfo{..} q = CI
291291
{ compKind= occNameToComKind name
292292
, insertText=rend
293293
, provenance = DefinedIn mod
294+
, typeText = Nothing
294295
, label=rend
295296
, typeText = Nothing
296297
, isInfix=Nothing

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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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)