Developers, Developers, Developers! Maksim Sorokin IT Blog


Config Files in Haskell

Here is an easy and simple way to read configuration files in Haskell using ConfigFile package.

Here is a simple configuration file test.cfg example:

key: value

And here is the program which reads the configuration file:

import Data.ConfigFile
import Data.Either.Utils

main =
 do val <- readfile emptyCP "test.cfg"
    let cp = forceEither val
    putStrLn $ forceEither $ get cp "" "key"
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.