Skip to content

Commit

Permalink
fix imports on stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Dec 21, 2023
1 parent 43baaf0 commit 9cc0f78
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Juvix/Compiler/Pipeline/Driver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ processImport' ::
processImport' entry p = do
checkCycle
local (over importParents (p :)) $
withPath'
p
( \path ->
cacheGet (EntryIndex entry {_entryPointModulePath = Just path})
)
withPath' p getCachedImport
where
checkCycle :: Sem r ()
checkCycle = do
Expand All @@ -155,6 +151,15 @@ processImport' entry p = do
in mapError (JuvixError @ScoperError) $
throw (ErrImportCycle (ImportCycle cyc))

getCachedImport :: Path Abs File -> Sem r (PipelineResult Store.ModuleInfo)
getCachedImport path = cacheGet (EntryIndex entry')
where
entry' =
entry
{ _entryPointStdin = Nothing,
_entryPointModulePath = Just path
}

processFileToStoredCore' ::
forall r.
(Members '[Reader ImportParents, Error JuvixError, Files, GitClone, PathResolver, MCache] r) =>
Expand Down

0 comments on commit 9cc0f78

Please sign in to comment.