1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/app/Commands/Dev/Core/Eval/Options.hs
2022-12-20 13:05:40 +01:00

39 lines
1.0 KiB
Haskell

module Commands.Dev.Core.Eval.Options where
import CommonOptions
import Evaluator qualified as Eval
import Juvix.Compiler.Core.Pretty.Options qualified as Core
data CoreEvalOptions = CoreEvalOptions
{ _coreEvalNoIO :: Bool,
_coreEvalInputFile :: AppPath File,
_coreEvalShowDeBruijn :: Bool
}
deriving stock (Data)
makeLenses ''CoreEvalOptions
instance CanonicalProjection CoreEvalOptions Core.Options where
project c =
Core.defaultOptions
{ Core._optShowDeBruijnIndices = c ^. coreEvalShowDeBruijn
}
instance CanonicalProjection CoreEvalOptions Eval.EvalOptions where
project c =
Eval.EvalOptions
{ _evalInputFile = c ^. coreEvalInputFile,
_evalNoIO = c ^. coreEvalNoIO
}
parseCoreEvalOptions :: Parser CoreEvalOptions
parseCoreEvalOptions = do
_coreEvalNoIO <-
switch
( long "no-io"
<> help "Don't interpret the IO effects"
)
_coreEvalShowDeBruijn <- optDeBruijn
_coreEvalInputFile <- parseInputJuvixCoreFile
pure CoreEvalOptions {..}