Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,350
    • Issues 5,350
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 575
    • Merge requests 575
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9881
Closed
Open
Issue created Dec 12, 2014 by Ryan Scott@RyanGlScottMaintainer

GHCi gives misleading error message when looking up info of ambiguous type

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‘)
Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC hvr
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking