
On Mon, Jul 5, 2010 at 2:41 PM, Ertugrul Soeylemez
Yes, there is some performance loss because of wrapping/unwrapping, but I think this loss is neglible for most applications. And I'd ask anyway. This is a discussion thread after all. =)
Pretty much all monad transformers are implemented as newtypes, so the wrapping and unwrapping operations themselves should get compiled into nothing, I think. It may be that the extra type faff makes inlining or other arcane optimisations less straightforward, but I see no reason to assume that monad transformers are necessarily even slightly slower than explicitly-constructed amalgamations. In my experience, something like ReaderT Params (StateT SessionData IO) a may *look* scary, but in all your code you just use ask and put and get anyway and they all work like magic - the difficult bits are generally speaking hidden in your type synonyms and run function. But then, my largest haskell projects have never been more than a thousand or so lines, so perhaps it's just an issue of scale.