1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 01:52:11 +03:00
juvix/app/Commands/Dev/Parse.hs
Jonathan Cubides 830b3be304
Add FileExt type (#2467)
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`
2023-10-25 12:02:12 +02:00

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