1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-22 06:11:36 +03:00
juvix/app/Commands/Dev/Core/Options.hs
2022-09-14 16:16:15 +02:00

49 lines
1.2 KiB
Haskell

module Commands.Dev.Core.Options where
import Commands.Dev.Core.Eval.Options
import Commands.Dev.Core.Read.Options
import Commands.Dev.Core.Repl.Options
import CommonOptions
data CoreCommand
= Repl CoreReplOptions
| Eval CoreEvalOptions
| Read CoreReadOptions
deriving stock (Data)
parseCoreCommand :: Parser CoreCommand
parseCoreCommand =
hsubparser $
mconcat
[ commandRepl,
commandEval,
commandRead
]
where
commandRepl :: Mod CommandFields CoreCommand
commandRepl = command "repl" replInfo
commandEval :: Mod CommandFields CoreCommand
commandEval = command "eval" evalInfo
commandRead :: Mod CommandFields CoreCommand
commandRead = command "read" readInfo
replInfo :: ParserInfo CoreCommand
replInfo =
info
(Repl <$> parseCoreReplOptions)
(progDesc "Start an interactive session of the JuvixCore evaluator")
evalInfo :: ParserInfo CoreCommand
evalInfo =
info
(Eval <$> parseCoreEvalOptions)
(progDesc "Evaluate a JuvixCore file and pretty print the result")
readInfo :: ParserInfo CoreCommand
readInfo =
info
(Read <$> parseCoreReadOptions)
(progDesc "Read a JuvixCore file, transform it, and pretty print it")