
#9881: GHCi gives misleading error message when looking up info of ambiguous type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Other Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- When GHCi imports multiple functions with the same name, using {{{:i}}} results in an ambiguous occurrence error: {{{
import Data.Text import Data.Text.Lazy :i length
Top level: Ambiguous occurrence ‘length’ It could refer to either ‘Data.Text.Lazy.length’, imported from ‘Data.Text.Lazy’ or ‘Prelude.length’, imported from ‘Prelude’ (and originally defined in ‘GHC.List’) or ‘Data.Text.length’, imported from ‘Data.Text’ }}} However, if you use {{{:i}}} on a type name that has imported multiple times in GHCi, a misleading error is given: {{{
import Data.Text import Data.Text.Lazy :i Text
Top level: Not in scope: data constructor ‘Text’ }}} The real problem is that the type name {{{Text}}} was imported twice with two different definitions, so the error should probably look something like this: {{{ Top level: Ambiguous occurrence ‘Text’ It could refer to either ‘Data.Text.Lazy.Text’, imported from ‘Data.Text.Lazy’ (and originally defined in ‘Data.Text.Internal.Lazy’) or ‘Data.Text.Text’, imported from ‘Data.Text’ (and originally defined in ‘Data.Text.Internal‘) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9881 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler