shake-language-c-0.5.0: Utilities for cross-compiling with Shake

Safe HaskellNone



This module provides utilities for reading values from configuration files, similar to the functions provided by Development.Shake.Config.



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"

parsePaths :: String -> [FilePath] Source

Parse a list of space separated paths from an input string. Spaces can be escaped by \ characters.

parsePaths "a b c\\ d" == ["a", "b", "c d"]

getPaths Source


:: (String -> Action (Maybe String))

Configuration lookup function

-> [String]

Configuration keys

-> Action [FilePath]

File paths

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.