From 2dac769561a7c5673e2775caba23aef7c3859bf0 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Mon, 9 Sep 2024 10:10:18 +0200 Subject: [PATCH] only output .debug.nockma file with the --debug flag --- 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))