ConfigFile-1.1.4: Configuration file reading & writing

Safe HaskellNone
LanguageHaskell98

Data.ConfigFile.Monadic

Contents

Synopsis

Overview

This module reexports a slightly different version of the standard API which makes it more convenient for chaining monadically. Everywhere a ConfigParser was the first argument in a function in the standard API, it is now the last. This lets you rewrite

do let cp = emptyCP
   cp <- add_section cp "sect1"
   cp <- set cp "sect1" "opt1" "foo"
   cp <- set cp "sect1" "opt2" "bar"
   options cp "sect1"

as

return emptyCP >>=
 add_section "sect1" >>=
 set "sect1" "opt1" "foo" >>=
 set "sect1" "opt2" "bar" >>=
 options "sect1"

which may be more elegant in some cases. A future development might be to chain the ConfigParser implicitly with a state monad, which would be yet more elegant.