1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/app/Commands/Dev/Scope.hs

29 lines
768 B
Haskell
Raw Normal View History

module Commands.Dev.Scope where
import GlobalOptions
import Juvix.Compiler.Concrete.Pretty qualified as Scoper
import Juvix.Prelude hiding (Doc)
import Options.Applicative
newtype ScopeOptions = ScopeOptions
{ _scopeInlineImports :: Bool
}
makeLenses ''ScopeOptions
parseScope :: Parser ScopeOptions
parseScope = do
_scopeInlineImports <-
switch
( long "inline-imports"
<> help "Show the code of imported modules next to the import statement"
)
pure ScopeOptions {..}
instance CanonicalProjection (GlobalOptions, ScopeOptions) Scoper.Options where
project (g, ScopeOptions {..}) =
Scoper.defaultOptions
{ Scoper._optShowNameIds = g ^. globalShowNameIds,
Scoper._optInlineImports = _scopeInlineImports
}