Skip to content

Commit 7794398

Browse files
fendorjneirapepeiborra
authored
Join nested IO actions of the form IO (IO ()) (#2459)
* Join nested IO actions of the form `IO (IO ())` * Disable ApplicativeDo Language Extension Co-authored-by: Javier Neira <[email protected]> Co-authored-by: Pepe Iborra <[email protected]>
1 parent 1b69975 commit 7794398

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

ghcide/ghcide.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ library
117117
unix
118118

119119
default-extensions:
120-
ApplicativeDo
121120
BangPatterns
122121
DeriveFunctor
123122
DeriveGeneric

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
245245
return $ do
246246
extras@ShakeExtras{logger, restartShakeSession, ideNc, knownTargetsVar, lspEnv
247247
} <- getShakeExtras
248-
let invalidateShakeCache = do
248+
let invalidateShakeCache :: IO ()
249+
invalidateShakeCache = do
249250
void $ modifyVar' version succ
250-
atomically $ recordDirtyKeys extras GhcSessionIO [emptyFilePath]
251+
join $ atomically $ recordDirtyKeys extras GhcSessionIO [emptyFilePath]
251252

252253
IdeOptions{ optTesting = IdeTesting optTesting
253254
, optCheckProject = getCheckProject
@@ -264,7 +265,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
264265
TargetModule _ -> do
265266
found <- filterM (IO.doesFileExist . fromNormalizedFilePath) targetLocations
266267
return (targetTarget, found)
267-
atomically $ recordDirtyKeys extras GetKnownTargets [emptyFilePath]
268+
join $ atomically $ recordDirtyKeys extras GetKnownTargets [emptyFilePath]
268269
modifyVarIO' knownTargetsVar $ traverseHashed $ \known -> do
269270
let known' = HM.unionWith (<>) known $ HM.fromList $ map (second Set.fromList) knownTargets
270271
when (known /= known') $

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE NoApplicativeDo #-}
21
{-# LANGUAGE TypeFamilies #-}
32
module Development.IDE.Core.Actions
43
( getAtPoint

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ setFileModified state saved nfp = do
263263
VFSHandle{..} <- getIdeGlobalState state
264264
when (isJust setVirtualFileContents) $
265265
fail "setFileModified can't be called on this type of VFSHandle"
266-
atomically $ recordDirtyKeys (shakeExtras state) GetModificationTime [nfp]
266+
join $ atomically $ recordDirtyKeys (shakeExtras state) GetModificationTime [nfp]
267267
restartShakeSession (shakeExtras state) (fromNormalizedFilePath nfp ++ " (modified)") []
268268
when checkParents $
269269
typecheckParents state nfp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ shakeOpen lspEnv defaultConfig logger debouncer
526526
_ <- async $ do
527527
logDebug logger "Initializing exports map from hiedb"
528528
em <- createExportsMapHieDb hiedb
529-
modifyVar' exportsMap (<> em)
529+
_ <- modifyVar' exportsMap (<> em)
530530
logDebug logger $ "Done initializing exports map from hiedb (" <> pack(show (ExportsMap.size em)) <> ")"
531531

532532
progress <- do

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE NoApplicativeDo #-}
32
{-# LANGUAGE PackageImports #-}
43
{-# LANGUAGE PatternSynonyms #-}
54
{-# HLINT ignore #-}

0 commit comments

Comments
 (0)