[Haskell-cafe] List-based ini parser?
mwm at mired.org
Sat Jul 4 01:41:16 UTC 2015
On Fri, Jul 3, 2015 at 8:24 PM Francesco Ariis <fa-ml at ariis.it> wrote:
> 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.
Is there a standard, specification or even some MS document that defines
what is and is not legal? I couldn't find one. Nor do I know of any system
that uses them for data interchange. Mostly they seem to be read & written
solely by the program that uses them for configuration info, and edited by
hand, so whatever the program accepts is legal.
That's the case for the ones I'm dealing with. Since changing the program
format - at least not without writing a converter - isn't an option, even
having an ISO standard wouldn't matter. I've gotta deal with what we have,
one way or another.
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  and change the upper level functions to suit
> your needs.
Was there a link in there? I didn't see one. And yes, I've thought of
writing my own parser for it. I figured I'd make one last check for a
library before doing that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe