minimal-configuration
Minimal ini like configuration library with a few extras
LTS Haskell 23.26: | 0.1.4 |
Stackage Nightly 2025-07-04: | 0.1.4 |
Latest on Hackage: | 0.1.4 |
LicenseRef-OtherLicense licensedbyMarius Ghita
Maintained by[email protected]
This version can be pinned in stack with:
minimal-configuration-0.1.4@sha256:d9c641e50292691c315411c61a53dd39924c7504e530ff5b9d59e71704dcd600,1808
Module documentation for 0.1.4
- System
- System.Config
Depends on 4 packages(full list with versions):
The module exported provides the ability to manage a configuration file inthe users home directory (or the Windows equivalent). Where the configurationtakes the form of key=value, without sections, that for example an '.ini'would have.
The library simplifies serilization/deserialization of the configuration intoa structure similar in behavior to aMap
, as well as an interactive way tofill in values for simple cases.
Consider the following example, where a user would run the application for thefirst time, it would ask him for his name; however on a followup run it wouldjust print a greeting with his name.
import System.Config.Filemain = loadLocal ".apprc" >>= \conf -> do let name = getV conf "name" case name of Just n -> putStrLn $ "hello " ++ n Nothing -> do conf' <- fillInteractively conf [("name", acceptNonBlank)] saveConfiguration conf'