GHC 9.6.1 rejects previously working code

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Wed Apr 12 09:10:10 UTC 2023


On Wed, Apr 12, 2023 at 02:32:43PM +0530, Harendra Kumar wrote:
> instance MonadIO m => Monad (T m) where
>     return = pure
>     (>>=) = undefined
> 
> instance MonadTrans T where
>     lift = undefined

I guess it's nothing to do with 9.6 per se, but rather the difference
between

* https://hackage.haskell.org/package/transformers-0.5.6.2/docs/Control-Monad-Trans-Class.html#t:MonadTrans

* https://hackage.haskell.org/package/transformers-0.6.1.0/docs/Control-Monad-Trans-Class.html#t:MonadTrans

I'm not sure I can see any solution for this.  A monad transformer `T`
must give rise to a monad `T m` regardless of what `m` is.  If `T m`
is only a monad when `MonadIO m` then `T` can't be a monad transformer
(under transformers 0.6).

Tom


More information about the ghc-devs mailing list