-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a64999
commit 9bcb734
Showing
12 changed files
with
198 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Commands.Dev.InstanceTermination where | ||
|
||
import Commands.Base | ||
import Commands.Dev.InstanceTermination.Calls qualified as Calls | ||
import Commands.Dev.InstanceTermination.Options | ||
|
||
runCommand :: InstanceTerminationCommand -> Sem r () | ||
runCommand = \case | ||
Calls opts -> Calls.runCommand opts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Commands.Dev.InstanceTermination.Calls where | ||
|
||
import Commands.Base | ||
import Commands.Dev.InstanceTermination.Calls.Options | ||
|
||
runCommand :: CallsOptions -> Sem r () | ||
runCommand CallsOptions {} = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Commands.Dev.InstanceTermination.Calls.Options where | ||
|
||
import CommonOptions | ||
import GlobalOptions | ||
import Juvix.Compiler.Internal.Pretty.Options qualified as Internal | ||
|
||
data CallsOptions = CallsOptions | ||
{ _callsShowDecreasingArgs :: Internal.ShowDecrArgs, | ||
_callsInputFile :: AppPath File | ||
} | ||
deriving stock (Data) | ||
|
||
makeLenses ''CallsOptions | ||
|
||
parseCalls :: Parser CallsOptions | ||
parseCalls = do | ||
_callsShowDecreasingArgs <- | ||
option | ||
decrArgsParser | ||
( long "show-decreasing-args" | ||
<> short 'd' | ||
<> value Internal.ArgRel | ||
<> helpDoc (enumHelp Internal.showDecrArgsHelp) | ||
) | ||
_callsInputFile <- parseInputFile FileExtJuvix | ||
pure CallsOptions {..} | ||
where | ||
decrArgsParser :: ReadM Internal.ShowDecrArgs | ||
decrArgsParser = enumReader Proxy | ||
|
||
instance CanonicalProjection (GlobalOptions, CallsOptions) Internal.Options where | ||
project (GlobalOptions {..}, CallsOptions {..}) = | ||
Internal.defaultOptions | ||
{ Internal._optShowNameIds = _globalShowNameIds, | ||
Internal._optShowDecreasingArgs = _callsShowDecreasingArgs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Commands.Dev.InstanceTermination.Options | ||
( module Commands.Dev.InstanceTermination.Options, | ||
module Commands.Dev.InstanceTermination.Calls.Options, | ||
) | ||
where | ||
|
||
import Commands.Dev.InstanceTermination.Calls.Options | ||
import Juvix.Prelude | ||
import Options.Applicative | ||
|
||
newtype InstanceTerminationCommand | ||
= Calls CallsOptions | ||
deriving stock (Data) | ||
|
||
parseInstanceTerminationCommand :: Parser InstanceTerminationCommand | ||
parseInstanceTerminationCommand = | ||
hsubparser $ | ||
mconcat | ||
[ commandCalls | ||
] | ||
where | ||
commandCalls :: Mod CommandFields InstanceTerminationCommand | ||
commandCalls = command "calls" minfo | ||
where | ||
minfo :: ParserInfo InstanceTerminationCommand | ||
minfo = | ||
info | ||
(Calls <$> parseCalls) | ||
(progDesc "Compute the calls table of a .juvix file") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters