Skip to content

Commit

Permalink
enable GhcSessionDeps reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed Dec 6, 2021
1 parent 1b1d3f5 commit ae571bc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,16 @@ loadGhcSession ghcSessionDepsConfig = do
Nothing -> LBS.toStrict $ B.encode (hash (snd val))
return (Just cutoffHash, val)

defineNoDiagnostics $ \(GhcSessionDeps_ fullModSummary) file -> do
env <- use_ GhcSession file
ghcSessionDepsDefinition fullModSummary ghcSessionDepsConfig env file
defineEarlyCutoff $ RuleWithCustomNewnessCheck (<=) $
-- This rule uses a custom newness check that relies on the derived 'Ord' instance:
-- * <previous> -> <new>
-- * GhcSessionDeps True -> GhcSessionDeps False: the prev session can be reused
-- * GhcSessionDeps False -> GhcSessionDeps True: the prev session cannot be reused
\(GhcSessionDeps_ fullModSummary) file -> do
env <- use_ GhcSession file
res <- ghcSessionDepsDefinition fullModSummary ghcSessionDepsConfig env file
return (Nothing, res)


newtype GhcSessionDepsConfig = GhcSessionDepsConfig
{ checkForImportCycles :: Bool
Expand Down

0 comments on commit ae571bc

Please sign in to comment.