mirror of
https://github.com/anoma/juvix.git
synced 2024-12-20 21:31:48 +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`
31 lines
833 B
Haskell
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 {..}
|