[Haskell-cafe] List-based ini parser?

Mike Meyer mwm at mired.org
Sat Jul 4 17:23:52 UTC 2015


Done. See https://github.com/magthe/hsini/issues/16 for the issue about
duplicate names, including a sample ini file. I've also opened
https://github.com/magthe/hsini/issues/17 about spaces in option names. I
didn't try section names, but I've seen them with spaces in them as well,
where they were used for creating GUI elements.

The wiki entry does mention the use of duplicate names for creating
multi-valued options. It also mentioned duplicate section names, but not
the specific use I'm dealing with.

I suspect fixing this in any of the current packages would require a
fundamental rewrite of the packages I've looked at, as they all store
options as Maps to string values, and sections as Maps to option value
maps. They either need to store lists instead of maps, or use maps to
polymorphic values.

For the record, I also created an issue for the in package
https://github.com/chrisdone/ini/issues/6, as it just hands back an empty
config structure for the example file. Values outside of sections aren't
handled.

On Sat, Jul 4, 2015 at 11:33 AM Magnus Therning <magnus at therning.org> 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?
>
> As the author of `hsini` I wouldn't mind if you created a bug report,
> explain the format you have (ideally you attach an example).
>
> Of course I can't promise any ETA, or even that it'll ever be done
> (you know how it's with FLOSS).
>
> I've pretty much used the "standard" described in the [INI article on
> Wikpedia](https://en.wikipedia.org/wiki/INI_file) and then picked the
> pieces I think make sense and have use for myself.
>
> /M
>
> --
> Magnus Therning                      OpenPGP: 0xAB4DFBA4
> email: magnus at therning.org   jabber: magnus at therning.org
> twitter: magthe               http://therning.org/magnus
>
> Finagle's Fourth Law:
> Once a job is fouled up, anything done to improve it only makes it
> worse.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150704/15467ae0/attachment.html>


More information about the Haskell-Cafe mailing list