Opened 7 years ago

Last modified 10 days ago

#4017 new bug

Unhelpful error message in GHCi

Reported by: simonpj Owned by: supersven
Priority: lowest Milestone:
Component: Compiler Version: 6.12.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

John Launchbury encountered an unhelpful error message in GHCi. Try this:

*Test> :i GHC.Integer.Type.Integer

Top level:
    Failed to load interface for `GHC.Integer.Type':
      it is a hidden module in the package `integer-gmp'
      Use -v to see a list of the files searched for.
*Test> 

Two points

  • The "-v" suggestion is no help at at all: a straightforward response is to try
    *Test> :i -v GHC.Integer.Type.Integer
    
    But that does not work. Either it should work, or the error message should say "Try :set -v to see a list..."
  • In any case, since we know it's a hidden module, it'd be more helpful to suggest "Possible fix: use :set -package integer-gmp.

It's also confusing that if you instead say:

*Test> :i Integer
data Integer
  = integer-gmp:GHC.Integer.Type.S# GHC.Prim.Int#
  | integer-gmp:GHC.Integer.Type.J# GHC.Prim.Int# GHC.Prim.ByteArray#
  	-- Defined in integer-gmp:GHC.Integer.Type
instance Enum Integer -- Defined in GHC.Num
instance Eq Integer -- Defined in GHC.Num
instance Integral Integer -- Defined in GHC.Real
instance Num Integer -- Defined in GHC.Num
instance Ord Integer -- Defined in GHC.Num
instance Read Integer -- Defined in GHC.Read
instance Real Integer -- Defined in GHC.Real
instance Show Integer -- Defined in GHC.Num
*Test> 

you get the info. So specifying the full name doesn't work (saying it can't load an interface) but the unqualified one does (which presumably involves loading the interface). Strange.

All in 6.12.

Simon

Change History (15)

comment:1 Changed 7 years ago by igloo

Milestone: 6.12.3

comment:2 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:3 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:4 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:5 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:6 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:7 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:8 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:9 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:10 Changed 3 years ago by thoughtpolice

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:11 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:12 Changed 21 months ago by thomie

Type of failure: None/UnknownIncorrect warning at compile-time

comment:13 Changed 21 months ago by thomie

Milestone: 8.0.1

comment:14 Changed 10 days ago by supersven

Owner: set to supersven

comment:15 Changed 10 days ago by supersven

Looks like things (or symptoms) changed a bit over time - The problem seems to be the same.

Starting a current version of GHC in interactive mode:

[nix-shell:~/src/ghc]$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.3.20170930: http://www.haskell.org/ghc/  :? for help

:i GHC.Integer.Type.Integer now responds with a "Not in scope" error. :i Integer still shows that GHC.Integer.Type.Integer is reachable:

Prelude> :i GHC.Integer.Type.Integer

<interactive>:1:1: error: Not in scope: ‘GHC.Integer.Type.Integer’
Prelude> :i Integer 
data Integer
  = integer-gmp-1.0.1.0:GHC.Integer.Type.S# GHC.Prim.Int#
  | integer-gmp-1.0.1.0:GHC.Integer.Type.Jp# {-# UNPACK #-}integer-gmp-1.0.1.0:GHC.Integer.Type.BigNat
  | integer-gmp-1.0.1.0:GHC.Integer.Type.Jn# {-# UNPACK #-}integer-gmp-1.0.1.0:GHC.Integer.Type.BigNat
  	-- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Eq Integer
  -- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Ord Integer
  -- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Show Integer -- Defined in ‘GHC.Show’
instance Read Integer -- Defined in ‘GHC.Read’
instance Enum Integer -- Defined in ‘GHC.Enum’
instance Num Integer -- Defined in ‘GHC.Num’
instance Real Integer -- Defined in ‘GHC.Real’
instance Integral Integer -- Defined in ‘GHC.Real’

Setting the "integer-gmp" package doesn't change the situation:

Prelude> :set -package integer-gmp
package flags have changed, resetting and loading new packages...
Prelude> :i Integer 
data Integer
  = integer-gmp-1.0.1.0:GHC.Integer.Type.S# GHC.Prim.Int#
  | integer-gmp-1.0.1.0:GHC.Integer.Type.Jp# {-# UNPACK #-}integer-gmp-1.0.1.0:GHC.Integer.Type.BigNat
  | integer-gmp-1.0.1.0:GHC.Integer.Type.Jn# {-# UNPACK #-}integer-gmp-1.0.1.0:GHC.Integer.Type.BigNat
  	-- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Eq Integer
  -- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Ord Integer
  -- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Show Integer -- Defined in ‘GHC.Show’
instance Read Integer -- Defined in ‘GHC.Read’
instance Enum Integer -- Defined in ‘GHC.Enum’
instance Num Integer -- Defined in ‘GHC.Num’
instance Real Integer -- Defined in ‘GHC.Real’
instance Integral Integer -- Defined in ‘GHC.Real’
Prelude> :i GHC.Integer.Type.Integer

<interactive>:1:1: error: Not in scope: ‘GHC.Integer.Type.Integer’

GHC.Integer.Type is still a hidden module:

Prelude> import GHC.Integer.Type

<no location info>: error:
    Could not find module ‘GHC.Integer.Type’
    it is a hidden module in the package ‘integer-gmp-1.0.1.0’

Summary

The error message of :i GHC.Integer.Type.Integer changed to "Not in scope". But :i Integer still shows that the requested information would be available.

Note: See TracTickets for help on using tickets.