-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't see that the contibutors files are fundementally different.
- From what I understand, it should be possible to write a 
generic function,

        importCSV :: FilePath -> IO [ (String,String) ]

where the 1st value is a field name and the 2nd the value extracted from 
the file.

As for the mapping to XML, I would suggest using HaXml and writing a 
set of functions that write the value for a field into the correct place.

These could then be indexed in another tuple list of type, 
        [(String, String -> CFilter)]

Then draw it all together with a liberal use of map and fold.

Tom

On Mon, 4 Aug 2003 10:05 pm, Tanton Gibbs wrote:
> Haskellers,
>
> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/L3z7Yha8TWXIQwoRAmhJAJ4hLxqRC7DmTE4PYRAG5mzKS7/Z5gCgj/QF
1zyl21u0fEMwkJeUWy8QVxs=
=fjzf
-----END PGP SIGNATURE-----

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

Reply via email to