GHC fails to import instance
The following code compiles in 7.8.4 but fails to compile in 7.10.1.
Tagged.hs
module Tagged where
import Control.Monad.Trans
newtype TaggedT s m b = TagT (m b)
instance MonadTrans (TaggedT s)
Main.hs
import Control.Monad.Trans.Class
import Tagged
returnT :: (MonadTrans t)
=> t m a -> t m a
returnT a = undefined
f :: TaggedT Int m a -> TaggedT Int m a
f = returnT
GHC complains
Could not deduce (MonadTrans (TaggedT Int))
arising from a use of ‘returnT’
If I change the import in Main to Control.Monad.Trans, 7.10.1 accepts the program. Since the import Control.Monad.Trans is actually a folder, the class MonadTrans must refer to the definition in Control.Monad.Trans.Class, so GHC should find the instance.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |