mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 01:52:11 +03:00
830b3be304
This PR introduces FileExt type, and consequently, one can generalise methods and matches based on the file extension; for example, `parseInputJuvixAsmFile` is now an app. `parseInputFile FileExtJuvixAsm`
14 lines
481 B
Haskell
14 lines
481 B
Haskell
module Commands.Dev.Parse where
|
|
|
|
import Commands.Base
|
|
import Commands.Dev.Parse.Options
|
|
import Juvix.Compiler.Concrete.Translation.FromSource qualified as Parser
|
|
import Text.Show.Pretty (ppShow)
|
|
|
|
runCommand :: (Members '[Embed IO, App] r) => ParseOptions -> Sem r ()
|
|
runCommand opts = do
|
|
m <-
|
|
head . (^. Parser.resultModules)
|
|
<$> runPipeline (opts ^. parseOptionsInputFile) upToParsing
|
|
if opts ^. parseOptionsNoPrettyShow then say (show m) else say (pack (ppShow m))
|