Developers, Developers, Developers! Maksim Sorokin IT Blog

9May/100

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)

No comments yet.


Leave a comment


Trackbacks are disabled.