
On Fri, Oct 27, 2006 at 06:28:58AM -0700, Chad Scherrer wrote:
Should I expect a monadic version to take a performance hit? What if I use some SPECIALIZE pragmas or somesuch? Is it more efficient to write one from scratch, or do specific type annotations give me the same thing anyway?
I was recently making experiments with rewriting a decoder for some data format in Haskell. At some point I had a hand-written State/Reader monad using unboxed tuples and I tried rewriting it to monad transformers. I was surprised that there was no difference in performance. This is a change from monadic version to monadic version, but the speed was at about 66% of the C++ version, so it seems monads didn't add much cost. BTW, the state and enviroment were Ptrs. Best regards Tomasz