[GHC] #10429: GHC fails to import instance

GHC ghc-devs at haskell.org
Mon May 18 05:56:48 UTC 2015


#10429: GHC fails to import instance
-------------------------------------+-------------------------------------
              Reporter:  crockeea    |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The following code compiles in 7.8.4 but fails to compile in 7.10.1.

 Tagged.hs
 {{{#!hs
 module Tagged where
 import Control.Monad.Trans
 newtype TaggedT s m b = TagT (m b)
 instance MonadTrans (TaggedT s)
 }}}

 Main.hs
 {{{#!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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10429>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list