
On Fri, Jan 21, 2005 at 02:53:04PM +0000, John Goerzen wrote:
I've been playing with HaXmL lately. I've had a need to convert one XML document to another, and HaXmL was very nice for that.
Along the way, I've discovered that I need to do some I/O as part of the conversion (specifically due to timezone-related calculations). Much of HaXML is based around the CFilter type:
type CFilter = Content -> [Content]
That is, most of the stuff one does in HaXML is a function with that type.
Try as I might, I could not figure out a nice way to integrate I/O into this system. A simple IO CFilter wouldn't work, since there has to be input available when it runs. Content -> IO [Content] didn't work either, since the IO ripples up all the way to the top, messing up the nice code everywhere.
If the timezone-related stuff is simple enough, you could perhaps use a function create_my_cfilter :: IO CFilter which does IO stuff to find the timezone, and then returns a pure function that uses that TZ info. -- David Roundy http://civet.berkeley.edu/droundy/