Skip to content

Commit

Permalink
Provide the body of the GenerateCore rule as a standalone function (#179
Browse files Browse the repository at this point in the history
)

We would like to use the rule without caching its artifacts.
  • Loading branch information
hurryabit authored Oct 28, 2019
1 parent 2337336 commit 8745d54
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module Development.IDE.Core.Rules(
getDependencies,
getParsedModule,
fileFromParsedModule,
generateCore,
) where

import Control.Monad
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8745d54

Please sign in to comment.