Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant embed @IO #2637

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Commands/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ writeCoreFile pa@Compile.PipelineArg {..} = do
Left e -> exitJuvixError e
Right md -> do
let txt = show (Core.ppOutDefault (Core.disambiguateNames md ^. Core.moduleInfoTable))
embed @IO $ writeFileEnsureLn coreFile txt
writeFileEnsureLn coreFile txt
12 changes: 6 additions & 6 deletions app/Commands/Dev/Core/Compile/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ runCPipeline pa@PipelineArg {..} = do
entryPoint <- getEntry pa
C.MiniCResult {..} <- getRight (run (runReader entryPoint (runError (coreToMiniC _pipelineArgModule :: Sem '[Error JuvixError, Reader EntryPoint] C.MiniCResult))))
cFile <- inputCFile _pipelineArgFile
embed @IO $ writeFileEnsureLn cFile _resultCCode
writeFileEnsureLn cFile _resultCCode
outfile <- Compile.outputFile _pipelineArgOptions _pipelineArgFile
Compile.runCommand
_pipelineArgOptions
Expand Down Expand Up @@ -100,7 +100,7 @@ runVampIRPipeline pa@PipelineArg {..} = do
entryPoint <- getEntry pa
vampirFile <- Compile.outputFile _pipelineArgOptions _pipelineArgFile
VampIR.Result {..} <- getRight (run (runReader entryPoint (runError (coreToVampIR _pipelineArgModule :: Sem '[Error JuvixError, Reader EntryPoint] VampIR.Result))))
embed @IO $ writeFileEnsureLn vampirFile _resultCode
writeFileEnsureLn vampirFile _resultCode

runAsmPipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runAsmPipeline pa@PipelineArg {..} = do
Expand All @@ -113,7 +113,7 @@ runAsmPipeline pa@PipelineArg {..} = do
$ _pipelineArgModule
tab' <- getRight r
let code = Asm.ppPrint tab' tab'
embed @IO $ writeFileEnsureLn asmFile code
writeFileEnsureLn asmFile code

runRegPipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runRegPipeline pa@PipelineArg {..} = do
Expand All @@ -126,7 +126,7 @@ runRegPipeline pa@PipelineArg {..} = do
$ _pipelineArgModule
tab' <- getRight r
let code = Reg.ppPrint tab' tab'
embed @IO $ writeFileEnsureLn regFile code
writeFileEnsureLn regFile code

runTreePipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runTreePipeline pa@PipelineArg {..} = do
Expand All @@ -139,7 +139,7 @@ runTreePipeline pa@PipelineArg {..} = do
$ _pipelineArgModule
tab' <- getRight r
let code = Tree.ppPrint tab' tab'
embed @IO $ writeFileEnsureLn treeFile code
writeFileEnsureLn treeFile code

runNockmaPipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runNockmaPipeline pa@PipelineArg {..} = do
Expand All @@ -152,4 +152,4 @@ runNockmaPipeline pa@PipelineArg {..} = do
$ _pipelineArgModule
tab' <- getRight r
let code = Nockma.ppSerialize tab'
embed @IO $ writeFileEnsureLn nockmaFile code
writeFileEnsureLn nockmaFile code
6 changes: 3 additions & 3 deletions app/Commands/Dev/Tree/Compile/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ runAsmPipeline pa@PipelineArg {..} = do
$ _pipelineArgTable
tab' <- getRight r
let code = Asm.ppPrint tab' tab'
embed @IO $ writeFileEnsureLn asmFile code
writeFileEnsureLn asmFile code

runRegPipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runRegPipeline pa@PipelineArg {..} = do
Expand All @@ -97,7 +97,7 @@ runRegPipeline pa@PipelineArg {..} = do
$ _pipelineArgTable
tab' <- getRight r
let code = Reg.ppPrint tab' tab'
embed @IO $ writeFileEnsureLn regFile code
writeFileEnsureLn regFile code

runNockmaPipeline :: (Members '[Embed IO, App, TaggedLock] r) => PipelineArg -> Sem r ()
runNockmaPipeline pa@PipelineArg {..} = do
Expand All @@ -110,4 +110,4 @@ runNockmaPipeline pa@PipelineArg {..} = do
$ _pipelineArgTable
tab' <- getRight r
let code = Nockma.ppSerialize tab'
embed @IO $ writeFileEnsureLn nockmaFile code
writeFileEnsureLn nockmaFile code
Loading