1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-25 00:21:41 +03:00
juvix/app/Commands/Dev/Core/Eval/Options.hs

49 lines
1.4 KiB
Haskell
Raw Normal View History

2022-09-14 17:16:15 +03:00
module Commands.Dev.Core.Eval.Options where
import CommonOptions
import Evaluator qualified as Eval
import Juvix.Compiler.Core.Pretty.Options qualified as Core
2022-09-14 17:16:15 +03:00
data CoreEvalOptions = CoreEvalOptions
{ _coreEvalNoIO :: Bool,
2022-12-20 15:05:40 +03:00
_coreEvalInputFile :: AppPath File,
_coreEvalShowDeBruijn :: Bool,
_coreEvalShowIdentIds :: Bool,
_coreEvalShowArgsNum :: Bool,
_coreEvalNoDisambiguate :: Bool
2022-09-14 17:16:15 +03:00
}
deriving stock (Data)
makeLenses ''CoreEvalOptions
instance CanonicalProjection CoreEvalOptions Core.Options where
project c =
Core.defaultOptions
{ Core._optShowDeBruijnIndices = c ^. coreEvalShowDeBruijn,
Core._optShowIdentIds = c ^. coreEvalShowIdentIds,
Core._optShowArgsNum = c ^. coreEvalShowArgsNum
}
instance CanonicalProjection CoreEvalOptions Eval.EvalOptions where
project c =
Eval.EvalOptions
{ _evalInputFile = c ^. coreEvalInputFile,
_evalNoIO = c ^. coreEvalNoIO,
_evalNoDisambiguate = c ^. coreEvalNoDisambiguate,
_evalPrintValues = False
}
2022-09-14 17:16:15 +03:00
parseCoreEvalOptions :: Parser CoreEvalOptions
parseCoreEvalOptions = do
_coreEvalNoIO <-
switch
( long "no-io"
<> help "Do not interpret the IO effects"
2022-09-14 17:16:15 +03:00
)
_coreEvalShowDeBruijn <- optDeBruijn
_coreEvalShowIdentIds <- optIdentIds
_coreEvalShowArgsNum <- optArgsNum
_coreEvalNoDisambiguate <- optNoDisambiguate
_coreEvalInputFile <- parseInputFile FileExtJuvixCore
2022-09-14 17:16:15 +03:00
pure CoreEvalOptions {..}