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

http://www.cit.gu.edu.au/~arock/hlibs/ABRHLibs.pdf

Cheers,
Rock.
--
Andrew Rock -- [EMAIL PROTECTED] -- http://www.cit.gu.edu.au/~arock/
School of Computing and Information Technology
Griffith University -- Nathan, Brisbane, Queensland 4111, Australia


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to