A small and simple text file configuration library written in Haskell. It is similar to the INI file format, but lacks a few of it's features, such as sections which will be added eventually. It is suitable for simple games that need to keep track of certain information between plays.
- data Configuration
- getValue :: Key -> [Configuration] -> Maybe Value
- repConfig :: Key -> Value -> [Configuration] -> [Configuration]
- readConfig :: FilePath -> IO [Configuration]
- writeConfig :: FilePath -> [Configuration] -> IO ()
- remKey :: Key -> [Configuration] -> [Configuration]
- addKey :: Key -> Value -> [Configuration] -> [Configuration]
Documentation
data Configuration Source
The Configuration
type takes a key and a value,
and returns a Configuration type.
getValue :: Key -> [Configuration] -> Maybe ValueSource
Utility function. Searches a Configuration for a key, and returns it's value.
repConfig :: Key -> Value -> [Configuration] -> [Configuration]Source
Utility function. Replaces the value for a key in a Configuration.
readConfig :: FilePath -> IO [Configuration]Source
Reads and parses a string from a file into a Configuration.
writeConfig :: FilePath -> [Configuration] -> IO ()Source
Parses a parsed Configuration back to a file.
remKey :: Key -> [Configuration] -> [Configuration]Source
Utility function. Removes a key and it's value from the configuration.
addKey :: Key -> Value -> [Configuration] -> [Configuration]Source
Adds a key and value to the end of the Configuration.