Give MonadTrans a QuantifiedConstraints superclass

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 2 05:27:28 UTC 2021


On Wed, 2 Jun 2021, Baldur Blöndal wrote:

> This is to advertise the proposal
> (https://gitlab.haskell.org/ghc/ghc/-/issues/19922) to add a
> superclass to the MonadTrans type class in Control.Monad.Trans.
>
> A Monad transformer 'trans' lifts a 'Monad m' to a 'Monad (trans m)'.
>
> This proposal code-ifies that with a superclass constraint:
>
>    class (forall m. Monad m => Monad (trans m)) => MonadTrans trans where
>      ..
>
> This is the main motiviating example of the Quantified Class
> Constraints paper https://gkaracha.github.io/papers/quantcs.pdf

So far, 'transformers' is mostly Haskell 98. This is why I prefer it to 
'mtl'. Wouldn't it be enough to add this extension to 'mtl'? I see that 
'mtl' re-uses the MonadTrans class from 'transformers' but maybe it should 
define its own class with the quantified constraints then.


More information about the Libraries mailing list