From 372375ef4d96f09861e1122c8ee940f67333e75f Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Mon, 9 Sep 2024 13:16:32 +0200 Subject: [PATCH] Only output .debug.nockma file with the --debug flag (#3006) --- app/Commands/Compile/Anoma.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Commands/Compile/Anoma.hs b/app/Commands/Compile/Anoma.hs index 3a0547bdd5..5b0086158e 100644 --- a/app/Commands/Compile/Anoma.hs +++ b/app/Commands/Compile/Anoma.hs @@ -23,11 +23,11 @@ runCommand opts = do $ coreRes ^. coreResultModule res <- getRight r - outputAnomaResult nockmaFile res + outputAnomaResult (opts' ^. compileDebug) nockmaFile res -outputAnomaResult :: (Members '[EmbedIO, App] r) => Path Abs File -> Nockma.AnomaResult -> Sem r () -outputAnomaResult nockmaFile Nockma.AnomaResult {..} = do +outputAnomaResult :: (Members '[EmbedIO, App] r) => Bool -> Path Abs File -> Nockma.AnomaResult -> Sem r () +outputAnomaResult debugOutput nockmaFile Nockma.AnomaResult {..} = do let code = Nockma.ppSerialize _anomaClosure - prettyNockmaFile = replaceExtensions' [".pretty", ".nockma"] nockmaFile + prettyNockmaFile = replaceExtensions' [".debug", ".nockma"] nockmaFile writeFileEnsureLn nockmaFile code - writeFileEnsureLn prettyNockmaFile (Nockma.ppPrint _anomaClosure) + when debugOutput (writeFileEnsureLn prettyNockmaFile (Nockma.ppPrint _anomaClosure))