dyre-0.9.2: Dynamic reconfiguration in Haskell

Safe Haskell | None
Language | Haskell2010

Config.Dyre.Options

Description

Handling for the command-line options that can be used to configure Dyre. As of the last count, there are four of them, and more are unlikely to be needed. The only one that a user should ever need to use is the `--force-reconf` option, so the others all begin with `--dyre-option-name`.

At the start of the program, before anything else occurs, the `withDyreOptions` function is used to hide Dyre's command-line options. They are loaded into the `IO` monad using the module System.IO.Storage. This keeps them safely out of the way of the user code and our own.

Later, when Dyre needs to access the options, it does so through the accessor functions defined here. When it comes time to pass control over to a new binary, it gets an argument list which preserves the important flags with a call to `customOptions`.

Synopsis

- removeDyreOptions :: [String] -> [String]
- withDyreOptions :: Params c r -> IO a -> IO a
- customOptions :: Maybe [String] -> IO [String]
- getDenyReconf :: IO Bool
- getForceReconf :: IO Bool
- getDebug :: IO Bool
- getMasterBinary :: IO (Maybe String)
- getStatePersist :: IO (Maybe String)

# Documentation

removeDyreOptions :: [String] -> [String] Source #

Remove all Dyre's options from the given commandline arguments.

withDyreOptions :: Params c r -> IO a -> IO a Source #

Store Dyre's command-line options to the IO-Store "dyre", and then execute the provided IO action with all Dyre's options removed from the command-line arguments.

customOptions :: Maybe [String] -> IO [String] Source #

Return the set of options which will be passed to another instance of Dyre. Preserves the master binary, state file, and debug mode flags, but doesn't pass along the forced-recompile flag. Can be passed a set of other arguments to use, or it defaults to using the current arguments when passed `Nothing`.

getDenyReconf :: IO Bool Source #

Get the value of the `--deny-reconf` flag, which disables recompilation. This overrides "--force-reconf", too.

getForceReconf :: IO Bool Source #

Get the value of the `--force-reconf` flag, which is used to force a recompile of the custom configuration.

getDebug :: IO Bool Source #

Get the value of the `--dyre-debug` flag, which is used to debug a program without installation. Specifically, it forces the application to use `.cache` as the cache directory, and `./` as the configuration directory.

getMasterBinary :: IO (Maybe String) Source #

Get the path to the master binary. This is set to the path of the current binary unless the `--dyre-master-binary=` flag is set. Obviously, we pass the `--dyre-master-binary=` flag to the custom configured application from the master binary.

getStatePersist :: IO (Maybe String) Source #

Get the path to a persistent state file. This is set only when the `--dyre-state-persist=` flag is passed to the program. It is used internally by Config.Dyre.Relaunch to save and restore state when relaunching the program.