@@ -228,7 +228,7 @@ shakeRunDatabaseProfile :: Maybe FilePath -> ShakeDatabase -> [Action a] -> IO [
228228shakeRunDatabaseProfile mbProfileDir shakeDb acts = do
229229 (time, (res,_)) <- duration $ shakeRunDatabase shakeDb acts
230230 whenJust mbProfileDir $ \dir -> do
231− count <- modifyVar profileCounter $ \x -> let y = x+1 in return (y,y)
231+ count <- modifyVar profileCounter $ \x -> let !y = x+1 in return (y,y)
232232 let file = "ide-" ++ profileStartTime ++ "-" ++ takeEnd 5 ("0000" ++ show count) ++ "-" ++ showDP 2 time <.> "html"
233233 shakeProfileDatabase shakeDb $ dir </> file
234234 return res
@@ -376,14 +376,16 @@ garbageCollect :: (NormalizedFilePath -> Bool) -> Action ()
376376garbageCollect keep = do
377377 ShakeExtras{state, diagnostics,publishedDiagnostics,positionMapping} <- getShakeExtras
378378 liftIO $
379− do newState <- modifyVar state $ return . dupe . HMap.filterWithKey (\(file, _) _ -> keep file)
380− modifyVar_ diagnostics $ return . filterDiagnostics keep
381− modifyVar_ publishedDiagnostics $ return . Map.filterWithKey (\uri _ -> keep (fromUri uri))
379+ do newState <- modifyVar state $ \values -> do
380+ values <- evaluate $ HMap.filterWithKey (\(file, _) _ -> keep file) values
381+ return $! dupe values
382+ modifyVar_ diagnostics $ \diags -> return $! filterDiagnostics keep diags
383+ modifyVar_ publishedDiagnostics $ \diags -> return $! Map.filterWithKey (\uri _ -> keep (fromUri uri)) diags
382384 let versionsForFile =
383385 Map.fromListWith Set.union $
384386 mapMaybe (\((file, _key), v) -> (filePathToUri' file,) . Set.singleton <$> valueVersion v) $
385387 HMap.toList newState
386− modifyVar_ positionMapping $ return . filterVersionMap versionsForFile
388+ modifyVar_ positionMapping $ \mappings -> return $! filterVersionMap versionsForFile mappings
387389define
388390 :: IdeRule k v
389391 => (k -> NormalizedFilePath -> Action (IdeResult v)) -> Rules ()
@@ -553,7 +555,9 @@ updateFileDiagnostics fp k ShakeExtras{diagnostics, publishedDiagnostics, state,
553555 newDiags <- modifyVar diagnostics $ \old -> do
554556 let newDiagsStore = setStageDiagnostics fp (vfsVersion =<< modTime) (T.pack $ show k) current old
555557 let newDiags = getFileDiagnostics fp newDiagsStore
556− pure (newDiagsStore, newDiags)
558+ _ <- evaluate newDiagsStore
559+ _ <- evaluate newDiags
560+ pure $! (newDiagsStore, newDiags)
557561 let uri = filePathToUri' fp
558562 let delay = if null newDiags then 0.1 else 0
559563 registerEvent debouncer delay uri $ do
@@ -561,7 +565,7 @@ updateFileDiagnostics fp k ShakeExtras{diagnostics, publishedDiagnostics, state,
561565 let lastPublish = Map.findWithDefault [] uri published
562566 when (lastPublish /= newDiags) $
563567 eventer $ publishDiagnosticsNotification (fromNormalizedUri uri) newDiags
564− pure (Map.insert uri newDiags published)
568+ pure $! Map.insert uri newDiags published
565569
566570publishDiagnosticsNotification :: Uri -> [Diagnostic] -> LSP.FromServerMessage
567571publishDiagnosticsNotification uri diags =
@@ -666,4 +670,4 @@ updatePositionMapping IdeState{shakeExtras = ShakeExtras{positionMapping}} Versi
666670 let updatedMapping =
667671 Map.insert _version idMapping $
668672 Map.map (\oldMapping -> foldl' applyChange oldMapping changes) mappingForUri
669− pure $ Map.insert uri updatedMapping allMappings
673+ pure $! Map.insert uri updatedMapping allMappings