Module Data.PropertyFile

A library to read and update files containing properties in the usual equational syntax, i.e., a property is defined by a line of the form prop=value where prop starts with a letter. All other lines (e.g., blank lines or lines starting with # are considered as comment lines and are ignored.

Author: Michael Hanus

Version: March 2021

Summary of exported operations:

readPropertyFile :: String -> IO [(String,String)]  Deterministic 
Reads a property file and returns the list of properties.
updatePropertyFile :: String -> String -> String -> IO ()  Deterministic 
Update a property in a property file or add it, if it is not already there.
getPropertyFromFile :: String -> String -> IO (Maybe String)  Deterministic 
Looks up the value of a property stored in a property file.
getPropertiesFromFile :: String -> [String] -> IO [Maybe String]  Deterministic 
Looks up the values of properties stored in a property file.

Exported operations:

readPropertyFile :: String -> IO [(String,String)]  Deterministic 

Reads a property file and returns the list of properties. Returns empty list if the property file does not exist.

updatePropertyFile :: String -> String -> String -> IO ()  Deterministic 

Update a property in a property file or add it, if it is not already there.

Example call:
(updatePropertyFile file pname pvalue)
Parameters:
  • file : the name of the property file
  • pname : the name of the property
  • pvalue : the new value of the property

getPropertyFromFile :: String -> String -> IO (Maybe String)  Deterministic 

Looks up the value of a property stored in a property file. Uppercase/lowercase is ignored for the property names.

getPropertiesFromFile :: String -> [String] -> IO [Maybe String]  Deterministic 

Looks up the values of properties stored in a property file. Uppercase/lowercase is ignored for the variable names.