From c8da68d3db0af4b6d9294892ed528c4421e16c46 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Mon, 12 Feb 2024 20:15:10 +0100 Subject: [PATCH] Remove redundant `embed @IO` (#2637) Since we upgraded to ghc-9.8.1 and dropped the dependency on [with-utf8](https://hackage.haskell.org/package/with-utf8), the function `writeFileEnsureLn` no longer has the constraint `MonadMask m`, so the `embed @IO` has become redundant --- app/Commands/Compile.hs | 2 +- app/Commands/Dev/Core/Compile/Base.hs | 12 ++++++------ app/Commands/Dev/Tree/Compile/Base.hs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Commands/Compile.hs b/app/Commands/Compile.hs index 5e185f9b0..56417d433 100644 --- a/app/Commands/Compile.hs +++ b/app/Commands/Compile.hs @@ -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 diff --git a/app/Commands/Dev/Core/Compile/Base.hs b/app/Commands/Dev/Core/Compile/Base.hs index 5f2daa625..d0b306f60 100644 --- a/app/Commands/Dev/Core/Compile/Base.hs +++ b/app/Commands/Dev/Core/Compile/Base.hs @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/app/Commands/Dev/Tree/Compile/Base.hs b/app/Commands/Dev/Tree/Compile/Base.hs index 71421c5dc..2368d4386 100644 --- a/app/Commands/Dev/Tree/Compile/Base.hs +++ b/app/Commands/Dev/Tree/Compile/Base.hs @@ -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 @@ -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 @@ -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