[GHC] #9611: Suggest the cause of "No instance" errors involving multiple versions of a package
#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
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): I expect this would be do-able (look in `TcErrors`), but it'd mean implementing a variant of the instance-matching code, to look for a match "by name" (where `p1:A.B.T` matches `p2:A.B.T`) rather than "by identity" where those two types are simply different. I can offer guidance if someone tackles this. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dmwit): * cc: me@… (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Yuras): * owner: => Yuras Comment: I'll try to implement it unless someone already is on it. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1919 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Yuras): * status: new => patch * differential: => Phab:D1919 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1919 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"5fc06b97b320e98febaa925085dac03e5b01fc5a/ghc" 5fc06b9/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5fc06b97b320e98febaa925085dac03e5b01fc5a" Suggest candidate instances in error message See Trac #9611. In "No instance..." error message we suggest instances for other types with the same occ name. It is usefull e.g. when we have two different versions of the same package installed. Test Plan: typecheck/should_fail/tcfail224 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1919 GHC Trac Issues: #9611 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: merge Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1919 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge * failure: None/Unknown => Incorrect warning at compile-time * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: merge Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1919 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"4c6e95e4f92516a925fd2a1bce0c0f8b5b9cbd17/ghc" 4c6e95e4/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="4c6e95e4f92516a925fd2a1bce0c0f8b5b9cbd17" Small refactor and comments Related to the fix to Trac #9611 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9611: Suggest the cause of "No instance" errors involving multiple versions of a package -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Yuras Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1919 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` a938c7ad62ccdd6ff4ea15df5ae2ddb8050a04df. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9611#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC