[Haskell-cafe] HaXmL and the IO Monad
Malcolm.Wallace at cs.york.ac.uk
Fri Jan 21 14:52:54 EST 2005
John Goerzen <jgoerzen at complete.org> writes:
> type CFilter = Content -> [Content]
> 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.
I have been toying with the idea that the CFilter type is nearly a
monad itself (return = keep, bind = o). If it can be re-formulated as
such, then there is a possibility that one could use monad transformers
(liftM etc) to compose the CFilter and IO monads easily.
However, recasting the HaXml combinator library monadically is rather
more work than I have time for at the moment...
More information about the Haskell-Cafe