Skip to content

Commit 8745d54

Browse files
authored
Provide the body of the GenerateCore rule as a standalone function (#179)
We would like to use the rule without caching its artifacts.
1 parent 2337336 commit 8745d54

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Development/IDE/Core/Rules.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Development.IDE.Core.Rules(
2323
getDependencies,
2424
getParsedModule,
2525
fileFromParsedModule,
26+
generateCore,
2627
) where
2728

2829
import Control.Monad
@@ -279,15 +280,17 @@ typeCheckRule =
279280
IdeOptions{ optDefer = defer} <- getIdeOptions
280281
liftIO $ typecheckModule defer packageState tms pm
281282

283+
generateCore :: NormalizedFilePath -> Action ([FileDiagnostic], Maybe CoreModule)
284+
generateCore file = do
285+
deps <- use_ GetDependencies file
286+
(tm:tms) <- uses_ TypeCheck (file:transitiveModuleDeps deps)
287+
setPriority priorityGenerateCore
288+
packageState <- hscEnv <$> use_ GhcSession file
289+
liftIO $ compileModule packageState tms tm
282290

283291
generateCoreRule :: Rules ()
284292
generateCoreRule =
285-
define $ \GenerateCore file -> do
286-
deps <- use_ GetDependencies file
287-
(tm:tms) <- uses_ TypeCheck (file:transitiveModuleDeps deps)
288-
setPriority priorityGenerateCore
289-
packageState <- hscEnv <$> use_ GhcSession file
290-
liftIO $ compileModule packageState tms tm
293+
define $ \GenerateCore -> generateCore
291294

292295

293296
-- A local rule type to get caching. We want to use newCache, but it has

0 commit comments

Comments
 (0)