2022-09-14 17:16:15 +03:00
|
|
|
module Commands.Dev.Internal.Options where
|
|
|
|
|
|
|
|
import Commands.Dev.Internal.Arity.Options
|
2022-11-07 16:47:56 +03:00
|
|
|
import Commands.Dev.Internal.CoreEval.Options
|
2022-09-14 17:16:15 +03:00
|
|
|
import Commands.Dev.Internal.Pretty.Options
|
|
|
|
import Commands.Dev.Internal.Typecheck.Options
|
|
|
|
import CommonOptions
|
|
|
|
|
|
|
|
data InternalCommand
|
|
|
|
= Pretty InternalPrettyOptions
|
|
|
|
| TypeCheck InternalTypeOptions
|
|
|
|
| Arity InternalArityOptions
|
2022-11-07 16:47:56 +03:00
|
|
|
| CoreEval InternalCoreEvalOptions
|
2022-09-14 17:16:15 +03:00
|
|
|
deriving stock (Data)
|
|
|
|
|
|
|
|
parseInternalCommand :: Parser InternalCommand
|
|
|
|
parseInternalCommand =
|
|
|
|
hsubparser $
|
|
|
|
mconcat
|
|
|
|
[ commandPretty,
|
|
|
|
commandArity,
|
2022-11-07 16:47:56 +03:00
|
|
|
commandTypeCheck,
|
|
|
|
commandCoreEval
|
2022-09-14 17:16:15 +03:00
|
|
|
]
|
|
|
|
where
|
|
|
|
commandArity :: Mod CommandFields InternalCommand
|
|
|
|
commandArity = command "arity" arityInfo
|
|
|
|
|
|
|
|
commandPretty :: Mod CommandFields InternalCommand
|
|
|
|
commandPretty = command "pretty" prettyInfo
|
|
|
|
|
|
|
|
commandTypeCheck :: Mod CommandFields InternalCommand
|
|
|
|
commandTypeCheck = command "typecheck" typeCheckInfo
|
|
|
|
|
2022-11-07 16:47:56 +03:00
|
|
|
commandCoreEval :: Mod CommandFields InternalCommand
|
|
|
|
commandCoreEval = command "core-eval" coreEvalInfo
|
|
|
|
|
2022-09-14 17:16:15 +03:00
|
|
|
arityInfo :: ParserInfo InternalCommand
|
|
|
|
arityInfo =
|
|
|
|
info
|
|
|
|
(Arity <$> parseInternalArity)
|
|
|
|
(progDesc "Translate a Juvix file to Internal and insert holes")
|
|
|
|
|
|
|
|
prettyInfo :: ParserInfo InternalCommand
|
|
|
|
prettyInfo =
|
|
|
|
info
|
|
|
|
(Pretty <$> parseInternalPretty)
|
|
|
|
(progDesc "Translate a Juvix file to Internal and pretty print the result")
|
|
|
|
|
|
|
|
typeCheckInfo :: ParserInfo InternalCommand
|
|
|
|
typeCheckInfo =
|
|
|
|
info
|
|
|
|
(TypeCheck <$> parseInternalType)
|
|
|
|
(progDesc "Translate a Juvix file to Internal and typecheck the result")
|
2022-11-07 16:47:56 +03:00
|
|
|
|
|
|
|
coreEvalInfo :: ParserInfo InternalCommand
|
|
|
|
coreEvalInfo =
|
|
|
|
info
|
|
|
|
(CoreEval <$> parseInternalCoreEval)
|
|
|
|
(progDesc "Translate a Juvix file to Core and evaluate the result")
|