I would recommend Ralf Hinze's ICFP00 Pearl Deriving Backtracking Monad Transformers http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.4164
He starts with a monad transformer expressed as a free term algebra, and shows step-by-step how to transform it to a more efficient context-passing style. He deals with exceptions and backtracking rather than IO; the ideas are quite similar though. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe