[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] List-based ini parser?
From:       Mike Meyer <mwm () mired ! org>
Date:       2015-07-04 17:23:52
Message-ID: CAD=7U2ChfiCD_T1o8WxW6aCJX_bUXqYjORc_65NAX1Mq159xgw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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@therning.org   jabber: magnus@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@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>

[Attachment #5 (text/html)]

<div dir="ltr">Done. See  <a \
href="https://github.com/magthe/hsini/issues/16">https://github.com/magthe/hsini/issues/16</a> \
for the issue about duplicate names, including a sample ini file. I&#39;ve also \
opened <a href="https://github.com/magthe/hsini/issues/17">https://github.com/magthe/hsini/issues/17</a> \
about spaces in option names. I didn&#39;t try section names, but I&#39;ve seen them \
with spaces in them as well, where they were used for creating GUI \
elements.<br><div><br></div><div>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&#39;m dealing with.</div><div><br></div><div>I suspect \
fixing this in any of the current packages would require a fundamental rewrite of the \
packages I&#39;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.</div><div><span \
style="font-size:13.1999998092651px;line-height:1.5">  </span><br></div><div>For the \
record, I also created an issue for the in package  <a \
href="https://github.com/chrisdone/ini/issues/6">https://github.com/chrisdone/ini/issues/6</a>, \
as it just hands back an empty config structure for the example file. Values outside \
of sections aren&#39;t handled.</div></div><br><div class="gmail_quote"><div \
dir="ltr">On Sat, Jul 4, 2015 at 11:33 AM Magnus Therning &lt;<a \
href="mailto:magnus@therning.org">magnus@therning.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Jul 03, 2015 at 11:26:03PM \
+0000, Mike Meyer wrote:<br> &gt; Ok,I&#39;ve looked at the packages google and \
hackage found (ini, hsini &amp;<br> &gt; ConfigFile), and can&#39;t use any of them \
for dealing with the ini files I&#39;m<br> &gt; being handed.<br>
&gt;<br>
&gt; The problem is they all parse the config file into Maps, and that \
doesn&#39;t<br> &gt; seem to be an option. I need lists, because I have multiple \
sections with<br> &gt; the same name that turn into a list of objects, as well as \
sections that<br> &gt; can have multiple options with the same name that turn into \
multiple<br> &gt; objects.<br>
&gt;<br>
&gt; Any chance I overlooked a parser? Or maybe some parsing options in<br>
&gt; ConfigFile?<br>
&gt;<br>
&gt; Any other advice on a library to do this?<br>
<br>
As the author of `hsini` I wouldn&#39;t mind if you created a bug report,<br>
explain the format you have (ideally you attach an example).<br>
<br>
Of course I can&#39;t promise any ETA, or even that it&#39;ll ever be done<br>
(you know how it&#39;s with FLOSS).<br>
<br>
I&#39;ve pretty much used the &quot;standard&quot; described in the [INI article \
on<br> Wikpedia](<a href="https://en.wikipedia.org/wiki/INI_file" rel="noreferrer" \
target="_blank">https://en.wikipedia.org/wiki/INI_file</a>) and then picked the<br> \
pieces I think make sense and have use for myself.<br> <br>
/M<br>
<br>
--<br>
Magnus Therning                                 OpenPGP: 0xAB4DFBA4<br>
email: <a href="mailto:magnus@therning.org" target="_blank">magnus@therning.org</a>   \
jabber: <a href="mailto:magnus@therning.org" \
                target="_blank">magnus@therning.org</a><br>
twitter: magthe                       <a href="http://therning.org/magnus" \
rel="noreferrer" target="_blank">http://therning.org/magnus</a><br> <br>
Finagle&#39;s Fourth Law:<br>
Once a job is fouled up, anything done to improve it only makes it<br>
worse.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" \
target="_blank">Haskell-Cafe@haskell.org</a><br> <a \
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" \
target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br> \
</blockquote></div>



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic