1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-16 10:56:14 +03:00
juvix/app/Commands/Dev/Core/Eval/Options.hs
Paul Cadman a246d57bff
Autocomplete ".jvc" input files for core {eval, read} commands (#1542)
Complete ".jvc" input files for core {eval, read} commands
2022-09-15 16:02:20 +01:00

31 lines
792 B
Haskell

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