[GHC] #9611: Suggest the cause of "No instance" errors involving multiple versions of a package

GHC ghc-devs at haskell.org
Fri Sep 19 03:47:53 UTC 2014


#9611: Suggest the cause of "No instance" errors involving multiple versions of a
package
-------------------------------------+-------------------------------------
       Reporter:  rwbarton           |                   Owner:
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 Suppose I have packages A-1.0, A-1.1, and B-1.0 built against A-1.0, and A
 (both versions) defines a type T which B defines to be an instance of some
 class C. If I load A-1.1 and B-1.0 into ghci and try to use the C T
 instance I will get a "No instance for C T" error, because T refers to
 A-1.1:T and B only defines an instance for A-1.0:T. However, if I don't
 realize this is what's going on, the error will be quite confusing as B
 appears to define an instance C T.

 Or, A could define the class C, rather than the type T, with the same
 result.

 This is quite common nowadays because there is a newer version of
 transformers (0.4.1.0) than the one which ships with GHC (0.3.0.0) and
 it's easy to end up installing mtl or lens against 0.3.0.0, and then some
 other package which pulls in 0.4.1.0.

 It would be nice to give a hint about what is going on, like
 {{{
 No instance for (MonadIO X) arising from a use of ‘liftIO’
 In the expression: ...
 ...
 Note: there is an instance transformers-0.3.0.0:MonadIO X
 }}}

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


More information about the ghc-tickets mailing list