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

Safe HaskellNone
LanguageHaskell98

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.

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"

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

Arguments

:: (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.

AltStyle によって変換されたページ (->オリジナル) /