Provide the body of the GenerateCore rule as a standalone function (#179)

We would like to use the rule without caching its artifacts.
This commit is contained in:
Martin Huschenbett 2019-10-28 14:01:11 -04:00 committed by GitHub
parent 233733664d
commit 8745d54ae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ module Development.IDE.Core.Rules(
getDependencies,
getParsedModule,
fileFromParsedModule,
generateCore,
) where
import Control.Monad
@ -279,15 +280,17 @@ typeCheckRule =
IdeOptions{ optDefer = defer} <- getIdeOptions
liftIO $ typecheckModule defer packageState tms pm
generateCore :: NormalizedFilePath -> Action ([FileDiagnostic], Maybe CoreModule)
generateCore file = do
deps <- use_ GetDependencies file
(tm:tms) <- uses_ TypeCheck (file:transitiveModuleDeps deps)
setPriority priorityGenerateCore
packageState <- hscEnv <$> use_ GhcSession file
liftIO $ compileModule packageState tms tm
generateCoreRule :: Rules ()
generateCoreRule =
define $ \GenerateCore file -> do
deps <- use_ GetDependencies file
(tm:tms) <- uses_ TypeCheck (file:transitiveModuleDeps deps)
setPriority priorityGenerateCore
packageState <- hscEnv <$> use_ GhcSession file
liftIO $ compileModule packageState tms tm
define $ \GenerateCore -> generateCore
-- A local rule type to get caching. We want to use newCache, but it has