
On Sat, 21 Mar 2009, Iavor Diatchki wrote:
Hello, There are a number of reasons why I prefer monadLib over mtl. None of them are huge issues, which is why I never bothered to "spread the word" :) Anyway, here are some of the differences off the top of my head (not in order of importance) - Nicer packaging: monadLib has 1 module (or 3 depending on how you look at it), mtl has 21
I think modules are there to be used. So, at least for me, it's a good thing, that MTL uses separate modules for different concerns. My critics is more that MTL uses identifiers that are designed as if everything could be in one module. E.g. State and StateT should be better State.Base and State.Transformer.
- Conceptually simpler types: monadLib provides two base mondas (Id and Lift) and one transformer per effect.
I find this idea very elegant. Now in transformers the base monads like State, Reader, Writer are replaced by type synonyms that equal StateT Identity and so on. This way, 'put' and 'get' do not need to be type class methods, at least when accessing the top monad in a stack. However I still don't understand, why monadLib achieves the distinction between lazy and strict in the base monad, whereas transformers has still distinct lazy and strict transformers.
- In monadLib one can throw arbitrary exceptions (there is no need for an Error class). I never understood what's the point of the class Error.
Error class was needed to implement the exception throwing as 'fail'. It's as broken as 'fail' belonging to Monad class.