Newbie Design Question
Thomas L. Bevan
Tue, 5 Aug 2003 09:46:35 +0000
=2D----BEGIN PGP SIGNED MESSAGE-----
I don't see that the contibutors files are fundementally different.
=2D From what I understand, it should be possible to write a=20
importCSV :: FilePath -> IO [ (String,String) ]
where the 1st value is a field name and the 2nd the value extracted from=20
As for the mapping to XML, I would suggest using HaXml and writing a=20
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,=20
[(String, String -> CFilter)]
Then draw it all together with a liberal use of map and fold.
On Mon, 4 Aug 2003 10:05 pm, Tanton Gibbs wrote:
> 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.=20
> 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 fil=
> 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 contributo=
> 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 t=
> 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
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
=2D----END PGP SIGNATURE-----