[Haskell-cafe] List-based ini parser?

Francesco Ariis fa-ml at ariis.it
Sat Jul 4 01:24:27 UTC 2015


On Fri, Jul 03, 2015 at 11:26:03PM +0000, Mike Meyer wrote:
> Ok,I've looked at the packages google and hackage found (ini, hsini &
> ConfigFile), and can't use any of them for dealing with the ini files I'm
> being handed.
> 
> The problem is they all parse the config file into Maps, and that doesn't
> seem to be an option. I need lists, because I have multiple sections with
> the same name that turn into a list of objects, as well as sections that
> can have multiple options with the same name that turn into multiple
> objects.
> 
> Any chance I overlooked a parser? Or maybe some parsing options in
> ConfigFile?
> 
> Any other advice on a library to do this?

Hello Mike,
    I am pretty sure multiple options with the same name are illegal or
undefined behaviour in .ini files, so I wouldn't bet on any of the
libraries supporting that.
Have you thought writing your own little Parsec parser? Probably not
the answer you were wishing for, but you could cannibalise this weirdly
written .ini parser [1] and change the upper level functions to suit
your needs.



More information about the Haskell-Cafe mailing list