1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-13 19:49:20 +03:00
juvix/app/Commands/Repl/Options.hs

38 lines
1020 B
Haskell
Raw Normal View History

module Commands.Repl.Options where
import CommonOptions
import Juvix.Compiler.Core.Pretty.Options qualified as Core
import Juvix.Compiler.Core.Transformation
data ReplOptions = ReplOptions
2022-12-20 15:05:40 +03:00
{ _replInputFile :: Maybe (AppPath File),
_replShowDeBruijn :: Bool,
_replNoPrelude :: Bool,
_replTransformations :: [TransformationId],
_replNoDisambiguate :: Bool,
_replPrintValues :: Bool
}
deriving stock (Data)
makeLenses ''ReplOptions
instance CanonicalProjection ReplOptions Core.Options where
project c =
Core.defaultOptions
{ Core._optShowDeBruijnIndices = c ^. replShowDeBruijn
}
parseRepl :: Parser ReplOptions
parseRepl = do
let _replTransformations = toEvalTransformations
_replShowDeBruijn = False
_replNoDisambiguate = False
_replPrintValues = True
_replInputFile <- optional parseInputJuvixFile
_replNoPrelude <-
switch
( long "no-prelude"
<> help "Do not load the Prelude module on launch"
)
pure ReplOptions {..}