Newbie Design Question

Tanton Gibbs
Mon, 4 Aug 2003 18:05:33 -0400


I'm currently working on my first Haskell program.  I really like the
language so far, though it has been hard to break the OO frame of mind.
Normally, I'm a C++/Perl programmer, but I have really enjoyed the
type-safety of Haskell over Perl as well as the Hugs interpreter over a make
cycle.  Since execution time is not important, I haven't found any issues
with using Hugs.

Now, on to my problem.  Our company uses XML to describe our processes.  I'm
writing a DSL in Haskell that will print that XML out.  I've done most of
it, but now I'm describing the I/O in the XML.  Basically, we have files
come in in various formats from various file contributors and we use a
mapping program to map the fields to the right spots in the XML.  So, for
example, one contributor could have the following layout:

Field Name         Start Pos         Length
First Name,              1,                   10
Last Name,              11,                  10

and another contributor could have them in exactly the opposite order.
Furthermore, some contributors may have fields that others don't (for
example: DOB).

I'm now trying to come up with a way to map this information into Haskell
dynamically.  It would be trivial to create a module for each Contributor
and then import all the modules.  However, we have hundreds of contributors
and it would be a pain to have to change and re-release the program every
time we added a new contributor.  Therefore, I need someway to take this
information and map it into my Haskell structures.  I have come up with two
options.  One would be to let Haskell dynamically import a contributor
module (but I don't think that is currently possible); the other would be to
use a configuration file and have the user specify the information through
it.  Is there a standard Config file module?  Is there any other way to do
this that I missed?

Thanks in advance,
Tanton Gibbs, Ph.D.
Technical Architect
Abilitec Knowledge Base
Acxiom Corporation
Conway, AR 72034