Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Apr 18, 2024
1 parent 64fe704 commit a76bbe2
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Juvix/Compiler/Pipeline/Driver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ processFileUpTo a = do
. runReader (res ^. pipelineResultImports)
. runReader (res ^. pipelineResult)
$ a
return $ set pipelineResult a' res
return (set pipelineResult a' res)

processFileUpToParsing' ::
forall r.
Expand All @@ -113,7 +113,12 @@ processFileUpToParsing' entry = do
res <- runReader entry upToParsing
let imports = res ^. Parser.resultParserState . Parser.parserStateImports
mtab <- processImports' entry (map (^. importModulePath) imports)
return (PipelineResult res mtab True)
return
PipelineResult
{ _pipelineResult = res,
_pipelineResultImports = mtab,
_pipelineResultChanged = True
}

processImports' ::
forall r.
Expand All @@ -131,7 +136,9 @@ processImports'' ::
Sem r (Bool, Store.ModuleTable)
processImports'' entry imports = do
ms <- forM imports (processImport' entry)
let mtab = Store.mkModuleTable (map (^. pipelineResult) ms) <> mconcatMap (^. pipelineResultImports) ms
let mtab =
Store.mkModuleTable (map (^. pipelineResult) ms)
<> mconcatMap (^. pipelineResultImports) ms
changed = any (^. pipelineResultChanged) ms
return (changed, mtab)

Expand Down Expand Up @@ -178,7 +185,7 @@ processFileToStoredCore' entry = ignoreHighlightBuilder $ do
. runReader entry
. runReader (res ^. pipelineResult)
$ upToStoredCore
return $ set pipelineResult r res
return (set pipelineResult r res)

processModule' ::
forall r.
Expand All @@ -204,12 +211,17 @@ processModule' (EntryIndex entry) = do
-- We need to check whether any of the recursive imports is fragile,
-- not only the direct ones, because identifiers may be re-exported
-- (with `open public`).
let fragile = any (^. Store.moduleInfoFragile) (HashMap.elems $ mtab ^. Store.moduleTable)
let fragile = any (^. Store.moduleInfoFragile) (mtab ^. Store.moduleTable)
if
| changed && fragile ->
recompile sha256 absPath
| otherwise ->
return (PipelineResult info mtab False)
return
PipelineResult
{ _pipelineResult = info,
_pipelineResultImports = mtab,
_pipelineResultChanged = False
}
_ ->
recompile sha256 absPath
where
Expand Down

0 comments on commit a76bbe2

Please sign in to comment.