From 25a00d9dae44dd1fce00ba554db252ffafcd3d86 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 9 Oct 2024 18:31:30 -0600 Subject: CompilationPhases are categories. --- Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs index 34ef997..97be0a3 100644 --- a/Main.hs +++ b/Main.hs @@ -20,10 +20,12 @@ import Options.Applicative import qualified System.Environment as System import System.Exit (exitWith) import System.IO (stderr, hPutStrLn) +import Control.Category ((>>>)) newtype IntermediateAst = IntermediateAst (GenericSyntaxTree Identity (Maybe Value)) deriving (Typeable) +-- | The total compilation pipeline. compilationPipeline :: ( FilePath -> IO @@ -50,6 +52,7 @@ compilationPipeline parse compile = >>> (dumpPhase "qualified" >>> consistencyCheckPhase) >>> dumpPhase "checked" +-- | Compilation phase that just emits an ast artifact. dumpPhase :: forall stage. ( Typeable stage, @@ -90,7 +93,7 @@ parseGlobalFlags :: Parser GlobalFlags parseGlobalFlags = GlobalFlags <$> argument str (metavar "INPUT" <> help "Input file") - <*> ((\b -> if b then jsonFormat else coloredFormat) <$> switch + <*> ((\b -> if b then jsonDiagnosticFormat else coloredFormat) <$> switch ( long "diagnostics-as-json" <> help "Dump diagnostics in JSON format." )) -- cgit