[Haskell-cafe] Improving MTL instances (was: Overlapping/Incoherent instances)

Henning Thielemann schlepptop at henning-thielemann.de
Wed Oct 15 16:50:19 EDT 2008

Ryan Ingram schrieb:
> On Mon, Oct 13, 2008 at 2:04 AM, J. Garrett Morris
> <jgmorris at cecs.pdx.edu> wrote:
>> Indeed - MTL seems to have been rewritten at some point in the past to
>> prefer exhaustive enumeration to overlap.
> Indeed, and I actually think this is a weakness of the current
> implementation.  Anyone who comes up with a new transformer that
> provides different functionality than what is there needs to
> explicitly provide all the relevant instances, instead of letting
> MonadTrans do its thing.

 I long thought that it is unnecessary use of type system extensions to
require multi-parameter type classes for simple monads and its
transformer versions. I thought it would be enough to have atomar monads
like ST, IO and Identity, and monads like State, Reader, Writer,
Continuation can be offered exclusively in the transforming variant.
(State s a) would have to be defined as (StateT s Identity a) instead.
This way MonadState, MonadReader and the other classes become
unnecessary. However, 'lift' remains important with this design.

More information about the Haskell-Cafe mailing list