1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-03 09:41:10 +03:00

Only output .debug.nockma file with the --debug flag (#3006)

This commit is contained in:
Jan Mas Rovira 2024-09-09 13:16:32 +02:00 committed by GitHub
parent ab2d31a313
commit 372375ef4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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))