Give MonadTrans a QuantifiedConstraints superclass

Baldur Blöndal <[email protected]>
Newsgroups gmane.comp.lang.haskell.libraries
Message-ID <CAK9DwL_-3S03OHM479j+YiYXY-SgJJPvNXqPC_ByqTmOHTzu5Q@mail.gmail.com>
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

Without it composition (·) as described in the paper can't be defined.
Uses include deriving MonadTrans via the composition of two
MonadTransformers:

  type Ok :: MonadTransformer
  newtype Ok m a = Ok (Int -> Int -> m a)
    deriving (Functor, Applicative, Monad)
    via (ReaderT Int · ReaderT Int) m
     :: Type -> Type

    deriving MonadTrans
    via ReaderT Int · ReaderT Int
     :: MonadTransformer
_______________________________________________
Libraries mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.