| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Development.Shake.Language.C.Config
Description
This module provides utilities for reading values from configuration files, similar to the functions provided by Development.Shake.Config.
Synopsis
- withConfig :: [FilePath] -> Rules ([(String, String)] -> FilePath -> String -> Action (Maybe String))
- mkConfig :: Rules ([FilePath] -> FilePath -> [(String, String)] -> String -> Action (Maybe String))
- parsePaths :: String -> [FilePath]
- getPaths :: (String -> Action (Maybe String)) -> [String] -> Action [FilePath]
Documentation
withConfig :: [FilePath] -> Rules ([(String, String)] -> FilePath -> String -> Action (Maybe String)) Source #
Given a list of dependencies, return a function that takes an environment of variable bindings, a configuration file path and a configuration variable and returns the corresponding configuration value.
This function is more flexible than usingConfigFile .
It allows the use of multiple configuration files as well as specifying default
variable bindings.
Typical usage would be something like this:
-- In the Rules monad
getConfig <- withConfig []
-- Then in an Action
... value <- getConfig [("variable", "default value")] "config.cfg" "variable"mkConfig :: Rules ([FilePath] -> FilePath -> [(String, String)] -> String -> Action (Maybe String)) Source #
Return a function that takes a list of dependencies, a configuration file path, an environment of variable bindings and a configuration variable and returns the corresponding configuration value.
This function is more flexible than usingConfigFile .
It allows the use of multiple configuration files as well as specifying default
variable bindings.
Typical usage would be something like this:
-- In the Rules monad
getConfig <- mkConfig
-- Then in an Action
... value <- getConfig ["some_generated_config.cfg"] [("variable", "default value")] "config.cfg" "variable"parsePaths :: String -> [FilePath] Source #
Parse a list of space separated paths from an input string. Spaces can be escaped by \ characters.
>>>parsePaths "/a /a/b /a/b/c\\ d"["/a","/a/b","/a/b/c d"]
Arguments
Configuration keys
Given a function that maps a configuration variable to a value and a list of variable names, return a corresponding list of file paths. Missing variables are ignored.