<div dir="ltr"><div>The following code compiles with older compilers but does not compile with GHC 9.6.1:</div><div><br></div><div>{-# LANGUAGE KindSignatures #-}<br>module A () where<br><br>import Control.Monad.IO.Class<br>import Control.Monad.Trans.Class<br><br>data T (m :: * -> *) a = T<br><br>instance Functor (T m) where<br>    fmap f T = undefined<br><br>instance Applicative (T m) where<br>    pure = undefined<br>    (<*>) = undefined<br><br>instance MonadIO m => Monad (T m) where<br>    return = pure<br>    (>>=) = undefined<br><br>instance MonadTrans T where<br>    lift = undefined</div><div><br></div><div>It fails with the following error:</div><div><br></div><div>xx.hs:20:10: error: [GHC-39999]<br>    • Could not deduce ‘MonadIO m’<br>        arising from the head of a quantified constraint<br>        arising from the superclasses of an instance declaration<br>      from the context: Monad m<br>        bound by a quantified context at xx.hs:20:10-21<br>      Possible fix:<br>        add (MonadIO m) to the context of a quantified context<br>    • In the instance declaration for ‘MonadTrans T’<br>   |<br>20 | instance MonadTrans T where<br>   |          ^^^^^^^^^^^^</div><div><br></div><div>What is the correct resolution for this?</div><div><br></div><div>-harendra<br></div></div>