dyre-0.9.2: Dynamic reconfiguration in Haskell

Safe Haskell | Safe-Inferred
Language | Haskell2010

Config.Dyre.Params

Description

Defines the `Params` datatype which Dyre uses to define all program-specific configuration data. Shouldn't be imported directly, as `Dyre` re-exports it.

Synopsis

- data Params cfgType a = Params {
  - projectName :: String
  - configCheck :: Bool
  - configDir :: Maybe (IO FilePath)
  - cacheDir :: Maybe (IO FilePath)
  - realMain :: cfgType -> IO a
  - showError :: cfgType -> String -> cfgType
  - includeDirs :: [FilePath]
  - hidePackages :: [String]
  - ghcOpts :: [String]
  - forceRecomp :: Bool
  - statusOut :: String -> IO ()
  - rtsOptsHandling :: RTSOptionHandling
  - includeCurrentDirectory :: Bool
  }
- data RTSOptionHandling
  - = RTSReplace [String]
  - | RTSAppend [String]

# Documentation

data Params cfgType a Source #

This structure is how all kinds of useful data is fed into Dyre. Of course, only the `projectName`, `realMain`, and `showError` fields are really necessary. By using the set of default values provided as `newParams`, you can get all the benefits of using Dyre to configure your program in only five or six lines of code.

Constructors

Params |

Fields

- projectName :: String

  The name of the project. This needs to also be the name of the executable, and the name of the configuration file.

- configCheck :: Bool

  Should Dyre look for and attempt to compile custom configurations? Useful for creating program entry points that bypass Dyre's recompilation, for testing purposes.

- configDir :: Maybe (IO FilePath)

  The directory to look for a configuration file in.

- cacheDir :: Maybe (IO FilePath)

  The directory to store build files in, including the final generated executable.

- realMain :: cfgType -> IO a

  The main function of the program. When Dyre has completed all of its recompilation, it passes the configuration data to this function and gets out of the way.

- showError :: cfgType -> String -> cfgType

  This function is used to display error messages that occur during recompilation, by allowing the program to modify its initial configuration.

- includeDirs :: [FilePath]

  Optional extra include dirs to use during compilation. To support installation via cabal-install, include the path returned from `Paths_<appName>.getLibDir`.

- hidePackages :: [String]

  Packages that need to be hidden during compilation

- ghcOpts :: [String]

  Miscellaneous GHC compilation settings go here

- forceRecomp :: Bool

  Should GHC be given the -fforce-recomp flag?

- statusOut :: String -> IO ()

  A status output function. Will be called with messages when Dyre recompiles or launches anything. A good value is 'hPutStrLn stderr', assuming there is no pressing reason to not put messages on stderr.

- rtsOptsHandling :: RTSOptionHandling

  Whether to append, or replace GHC runtime system options with others.

- includeCurrentDirectory :: Bool

  Whether to add current directory to include list (set False to prevent name shadowing within project directory.) --

data RTSOptionHandling Source #

Specify additional or replacement GHC runtime system options

Constructors

RTSReplace [String] | replaces RTS options with given list
RTSAppend [String] | merges given list with RTS options from command line (so that nothing is lost)