Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread C. McCann
On Mon, Aug 9, 2010 at 3:42 PM, Job Vranish wrote: > For monads like StateT, WriterT, ReaderT, the order doesn't matter (except > perhaps for some pesky performance details). However, for monad transformers > like ErrorT or ListT, the order _does_ matter. Is it really correct to say that order do

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Gregory Crosswhite
I've never used this myself, but the package mtlx seems to offer one possible solution to this problem by tagging the monad transformers with index types: http://hackage.haskell.org/package/mtlx Cheers, Greg On 08/09/10 12:39, Gábor Lehel wrote: > Actually, while I haven't even used monad t

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Gábor Lehel
2010/8/9 Edward Z. Yang : > Excerpts from Gábor Lehel's message of Mon Aug 09 15:39:49 -0400 2010: >> Actually, while I haven't even used monad transformers before (just >> read about them a lot), I was thinking that something like this might >> be the way to solve the lift . lift . lift . lift . f

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Edward Z. Yang
Excerpts from Gábor Lehel's message of Mon Aug 09 15:39:49 -0400 2010: > Actually, while I haven't even used monad transformers before (just > read about them a lot), I was thinking that something like this might > be the way to solve the lift . lift . lift . lift . foo problem on the > one hand, a

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Job Vranish
For monads like StateT, WriterT, ReaderT, the order doesn't matter (except perhaps for some pesky performance details). However, for monad transformers like ErrorT or ListT, the order _does_ matter. The code you have there is perfectly fine, sometimes the added generality can be quite handy (espec

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Gábor Lehel
Actually, while I haven't even used monad transformers before (just read about them a lot), I was thinking that something like this might be the way to solve the lift . lift . lift . lift . foo problem on the one hand, and by wrapping the 'contents' (e.g. the environment of a reader monad) of every

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Edward Z. Yang
Excerpts from aditya siram's message of Mon Aug 09 15:05:14 -0400 2010: > Until test is called in 'main' we don't know the order of monads. In fact > even the base monad is not know. All we know is that it uses the State and > Writer monad. In each call to 'test' in main we can determine the stacki

[Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread aditya siram
Hi all, I was experimenting with monad transformers and realized that the stacking order of the monads can remain unknown until it is used. Take for example the following code: import "mtl" Control.Monad.State import "mtl" Control.Monad.Writer import "mtl" Control.Monad.Identity test :: (MonadWri