Handling large ini files.

Andrew Rock A.Rock@griffith.edu.au
Sun, 13 Jul 2003 10:09:21 +1000

On Sunday, July 13, 2003, at 06:54 AM, Thaddeus L. Olczyk wrote:

> A while ago I looked at Haskell. I got stuck on a problem which
> basically caused me to stop using Haskell.
> Realising that I never asked anyone else how they would approach the
> deal, I decided to ask before I put the final chapter on Haskell.
> I have a program that requires a lot of customisation.
> As a result there is an initialization file with many entries
> ( typically 30-80 entries ). Some of these entries need to be
> accessed quite often, so that opening the file and reading in on
> demand is not really an option.
> So the basic question is how do I handle access to these parameters?
> PS: I've thought of Hugh's approach to global variables, but even with
> compound data structures it really isn't practical for such a large
> number. Not even when creating compound structures to hold the data.
> Worse you wind up with data structures which are not coherent having
> only the fact that each is a customisation in common.

I think that each being a customisation *is* sufficient for coherence
of one data structure to hold them all.

My approach was to define a data structure that stored a
sequence of flags, bindings of property names to values,
sets of those, and sequences of those. For this I wrote a
parser and some accessor functions.

See section 7 in


Andrew Rock -- A.Rock@griffith.edu.au -- 
School of Computing and Information Technology
Griffith University -- Nathan, Brisbane, Queensland 4111, Australia