On Mon, Oct 6, 2008 at 9:48 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > Andrew Coppin wrote: >> >> I have some longwinded code that works, but I'm still thinking about how >> to do this more elegantly. It looks like what I really need is something >> like >> >> type M = StateT State (ResultSetT (ErrorT ErrorType Identity)) >> >> Is that the correct ordering? >> >> If so, I guess that means I have to somehow construct ResultSetT. Is there >> an easy way to do that, given that I already have ResultSet? For example, if >> I put ResultSet into Traversable, would that let me do it? > > ...and again I'm talking to myself... :-/ > > So after much experimentation, I have managed to piece together the > following facts: > > - It appears that the outer-most monad transformer represents the inner-most > monad. So "StateT Foo ListT" means a list of stateful computations, while > "ListT (StateT Foo)" means a stateful list of computations.
Have you read "Monad Transformers Step by Step" [1] by Martin Grabmueller? It's a fantastic introduction to these beasties, leading the reader through a series of transformations from pure code to using about 4 different monads/transformers for all sorts of extra features. Seriously recommend it. []: <http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.pdf> Cheers, D _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe