Skip to content

Commit

Permalink
use evalContT
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed May 27, 2024
1 parent da56bfb commit fb0a370
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ import Control.Concurrent.STM.Stats (atomically, modifyTVar',
import Control.Concurrent.STM.TQueue
import Control.DeepSeq
import Control.Exception (evaluate)
import Control.Monad.Cont (ContT (ContT), runContT)
import Control.Monad.IO.Unlift (MonadUnliftIO)
import Control.Monad.Trans.Cont (ContT (ContT), evalContT)
import Data.Foldable (for_)
import Data.HashMap.Strict (HashMap)
import Data.HashSet (HashSet)
Expand Down Expand Up @@ -397,7 +397,7 @@ dbThread = ThreadRun {
recorder
rng
(withHieDb fp (const $ pure ()) `Safe.catch` \IncompatibleSchemaVersion{} -> removeFile fp)
flip runContT return $ do
evalContT $ do
writeDb <- ContT $ withHieDb fp
readDb <- ContT $ withHieDb fp
let withWriteDbRetryable :: WithHieDb
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/LSP/LanguageServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import UnliftIO.Directory
import UnliftIO.Exception

import qualified Colog.Core as Colog
import Control.Monad.Cont (ContT (ContT, runContT))
import Control.Monad.IO.Unlift (MonadUnliftIO)
import Control.Monad.Trans.Cont (ContT (evalContT))
import Development.IDE.Core.IdeConfiguration
import Development.IDE.Core.Shake hiding (Log)
import Development.IDE.Core.Thread (ThreadRun (..),
Expand Down Expand Up @@ -253,7 +253,7 @@ handleInit recorder getHieDbLoc getIdeState lifetime exitClientMsg clearReqId wa


runWithDb :: Recorder (WithPriority Session.Log) -> FilePath -> (WithHieDb -> ThreadQueue -> IO ()) -> IO ()
runWithDb recorder dbLoc f = flip runContT return $ do
runWithDb recorder dbLoc f = evalContT $ do
(_, sessionRestartTQueue) <- runInThread sessionRestartThread ()
(_, sessionLoaderTQueue) <- runInThread sessionLoaderThread ()
(WithHieDbShield hiedb, hieChan) <- runInThread dbThread (recorder, dbLoc)
Expand Down

0 comments on commit fb0a370

Please sign in to comment.