mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 18:13:56 +03:00
830b3be304
This PR introduces FileExt type, and consequently, one can generalise methods and matches based on the file extension; for example, `parseInputJuvixAsmFile` is now an app. `parseInputFile FileExtJuvixAsm`
40 lines
1.1 KiB
Haskell
40 lines
1.1 KiB
Haskell
module Commands.Repl.Options where
|
|
|
|
import CommonOptions
|
|
import Juvix.Compiler.Core.Pretty.Options qualified as Core
|
|
import Juvix.Compiler.Core.Transformation
|
|
|
|
data ReplOptions = ReplOptions
|
|
{ _replIsDev :: Bool,
|
|
_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
|
|
_replIsDev = False
|
|
_replInputFile <- optional (parseInputFile FileExtJuvix)
|
|
_replNoPrelude <-
|
|
switch
|
|
( long "no-prelude"
|
|
<> help "Do not load the Prelude module on launch"
|
|
)
|
|
pure ReplOptions {..}
|