1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-20 21:31:48 +03:00
juvix/app/Commands/Dev/Core/Strip/Options.hs
Jonathan Cubides 830b3be304
Add FileExt type (#2467)
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`
2023-10-25 12:02:12 +02:00

31 lines
833 B
Haskell

module Commands.Dev.Core.Strip.Options where
import CommonOptions
import Juvix.Compiler.Core.Pretty.Options qualified as Core
data CoreStripOptions = CoreStripOptions
{ _coreStripShowDeBruijn :: Bool,
_coreStripNoPrint :: Bool,
_coreStripInputFile :: AppPath File
}
deriving stock (Data)
makeLenses ''CoreStripOptions
instance CanonicalProjection CoreStripOptions Core.Options where
project c =
Core.defaultOptions
{ Core._optShowDeBruijnIndices = c ^. coreStripShowDeBruijn
}
parseCoreStripOptions :: Parser CoreStripOptions
parseCoreStripOptions = do
_coreStripShowDeBruijn <- optDeBruijn
_coreStripNoPrint <-
switch
( long "no-print"
<> help "do not print the stripped code"
)
_coreStripInputFile <- parseInputFile FileExtJuvixCore
pure CoreStripOptions {..}