[GHC] #8278: Improve error message when the same type is imported from two different library versions

#8278: Improve error message when the same type is imported from two different library versions ------------------------------------+------------------------------------- Reporter: Yuras | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- When a package indirectly depends on different versions of the same library, ghc reports cryptic error: {{{ Couldn't match expected type `ByteString' with actual type `bytestring-0.9.2.1:Data.ByteString.Internal.ByteString' }}} Error contains fully qualified type with package name and version only when the type is imported from different versions on the library, so looks like ghc knows what is wrong. Is it possible to add something like the next: {{{ Note: ByteString is imported from different package versions: bytestring-0.9.2.1 and bytestring-0.10.0.1 }}} It is inspired by a number of StackOverflow questions (e.g. http://stackoverflow.com/questions/12576817/couldnt-match-expected-type- with-actual-type-error-when-using-codec-bmp/12577025#12577025, http://stackoverflow.com/questions/18767086/bytestring-to-lazy-text-and- vice-versa/18769431?noredirect=1#comment27676563_18769431) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8278: Improve error message when the same type is imported from two different library versions -------------------------------------+------------------------------------ Reporter: Yuras | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by Yuras): * type: bug => feature request -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8278: Improve error message when the same type is imported from two different library versions -------------------------------------+------------------------------------ Reporter: Yuras | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Yuras): And related request: in the same situation (two versions of the same library) when instance of class A for bytestring-0.9.2.1:Data.ByteString.Internal.ByteString is in scope, but the instance for ByteString is not in scope, is it possible to add a special note? Realworld case: http://stackoverflow.com/questions/11068272/acid-state- monadstate-instance-for-update -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8278: Improve error message when the same type is imported from two different
library versions
-------------------------------------+------------------------------------
Reporter: Yuras | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Simon Peyton Jones

#8278: Improve error message when the same type is imported from two different
library versions
-------------------------------------+------------------------------------
Reporter: Yuras | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Simon Peyton Jones

#8278: Improve error message when the same type is imported from two different library versions -------------------------------------------------+------------------------- Reporter: Yuras | Owner: Type: feature request | Status: Priority: normal | closed Component: Compiler | Milestone: Resolution: fixed | Version: 7.6.3 Operating System: Unknown/Multiple | Keywords: Type of failure: None/Unknown | Architecture: Test Case: | Unknown/Multiple typecheck/should_fail/tcfail182 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_fail/tcfail182 * resolution: => fixed Comment: Good idea. Much improved now I think: {{{ Couldn't match expected type ‛T8278a.Maybe’ with actual type ‛Maybe a0’ NB: ‛T8278a.Maybe’ is defined in ‛T8278a’ ‛Maybe’ is defined in ‛Data.Maybe’ in package ‛base’ In the first argument of ‛f’, namely ‛Nothing’ }}} However implementing the idea in Comment 2 is much harder. If you think it's important and/or you trip over it a lot in practice, please open a new ticket. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8278: Improve error message when the same type is imported from two different
library versions
-------------------------------------------------+-------------------------
Reporter: Yuras | Owner:
Type: feature request | Status:
Priority: normal | closed
Component: Compiler | Milestone:
Resolution: fixed | Version: 7.6.3
Operating System: Unknown/Multiple | Keywords:
Type of failure: None/Unknown | Architecture:
Test Case: | Unknown/Multiple
typecheck/should_fail/tcfail182 | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
-------------------------------------------------+-------------------------
Comment (by Simon Peyton Jones

#8278: Improve error message when the same type is imported from two different library versions -------------------------------------+------------------------------------- Reporter: Yuras | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/tcfail182 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dmwit): Just wanted to pipe up and say I've just been hit by the problem in Comment 2. It seems it doesn't happen very often; but when it does happen it's quite confusing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8278: Improve error message when the same type is imported from two different library versions -------------------------------------+------------------------------------- Reporter: Yuras | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/tcfail182 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): #9611 is the ticket for comment:2, I believe. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8278#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC