Safe Haskell | None |
---|---|
Language | Haskell98 |
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 /a/b /a/b/c\\ d"
["/a","/a/b","/a/b/c d"]