Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Johan Tibell
I'm trying to refactor the integer-gmp package to fix the breakage
explained in #5384. During the refactoring I

* moved GHC.Integer.Type to GHC.Integer.GMP.Type, and
* added a new GHC.Integer.Type module that re-exports parts of the
interface now exposed by GHC.Integer.GMP.Type

The content of GHC.Integer.Type is just:

{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_HADDOCK hide #-}

-- If you change the module name or the export list you must update
-- compiler/prelude/PrelNames.lhs.
module GHC.Integer.Type (
  Integer(..)
, plusInteger
, timesInteger
, smallInteger
, integerToWord
, integerToInt
, minusInteger
, negateInteger
, eqInteger
, neqInteger
, absInteger
, signumInteger
, leInteger
, gtInteger
, ltInteger
, geInteger
, compareInteger
, gcdInteger
, lcmInteger
, andInteger
, orInteger
, xorInteger
, complementInteger
, shiftLInteger
, shiftRInteger
) where

import GHC.Integer.GMP.Type

GHC doesn't seem to like this at all. It can no longer find the
GHC.Integer.Type.Integer type:

$ inplace/bin/ghc-stage1   -H64m -O -fasm-package-name
base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
-ilibraries/base/dist-install/build
-ilibraries/base/dist-install/build/autogen
-Ilibraries/base/dist-install/build
-Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
-optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
-optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
-package-name base -XHaskell98 -XCPP -O -dcore-lint
-no-user-package-conf -rtsopts -odir
libraries/base/dist-install/build -hidir
libraries/base/dist-install/build -stubdir
libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
libraries/base/./Data/Maybe.hs -o
libraries/base/dist-install/build/Data/Maybe.o

libraries/base/Data/Maybe.hs:70:13:
Can't find interface-file declaration for type constructor or
class integer-gmp:GHC.Integer.Type.Integer
  Probable cause: bug in .hi-boot file, or inconsistent .hi file
  Use -ddump-if-trace to get an idea of which file caused the error
When deriving the instance for (Eq (Maybe a))

Here's the -ddump-if-trace log:

$ inplace/bin/ghc-stage1   -H64m -O -fasm-package-name
base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
-ilibraries/base/dist-install/build
-ilibraries/base/dist-install/build/autogen
-Ilibraries/base/dist-install/build
-Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
-optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
-optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
-package-name base -XHaskell98 -XCPP -O -dcore-lint
-no-user-package-conf -rtsopts -odir
libraries/base/dist-install/build -hidir
libraries/base/dist-install/build -stubdir
libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
libraries/base/./Data/Maybe.hs -o
libraries/base/dist-install/build/Data/Maybe.o -ddump-if-trace
FYI: cannont read old interface file:
libraries/base/dist-install/build/Data/Maybe.hi: openBinaryFile:
does not exist (No such file or directory)
Considering whether to load base:GHC.Base
Reading interface for base:GHC.Base;
reason: GHC.Base is directly imported
readIFace libraries/base/dist-install/build/GHC/Base.hi
updating EPS_
Considering whether to load ghc-prim:GHC.Generics
Reading interface for ghc-prim:GHC.Generics;
reason: GHC.Generics is directly imported
readIFace 
/usr/local/google/src/ghc/libraries/ghc-prim/dist-install/build/GHC/Generics.hi
updating EPS_
updating EPS_
Considering whether to load base:GHC.Base {- SYSTEM -}
loadHiBootInterface base:Data.Maybe
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Reading interface for ghc-prim:GHC.Types;
reason: Checking fixity for :
readIFace 
/usr/local/google/src/ghc/libraries/ghc-prim/dist-install/build/GHC/Types.hi
updating EPS_
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Starting fork { Declaration for Monad
Loading decl for GHC.Base.Monad
updating EPS_
buildClass
buildClass GHC.Base.T:Monad
} ending fork Declaration for Monad
Starting fork { Declaration for Functor
Loading decl for GHC.Base.Functor
updating EPS_
buildClass
buildClass GHC.Base.T:Functor
} ending fork Declaration for Functor
tcImportDecl GHC.Classes.Eq
Need decl for GHC.Classes.Eq
Considering whether to load ghc-prim:GHC.Classes {- SYSTEM -}
Reading interface for ghc-prim:GHC.Classes;
reason: Need decl for GHC.Classes.Eq
readIFace 
/usr/local/google/src/ghc/libraries/ghc-prim/dist-install/build/GHC/Classes.hi
updating EPS_
Starting fork { Declaration for Eq
Loading decl for GHC.Classes.Eq
updating EPS_
buildClass
buildClass GHC.Classes.T:Eq
} ending fork Declaration for Eq
Starting fork { Declaration for Ord
Loading decl for 

RE: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Simon Peyton-Jones
My guess is that you have not updated compiler/prelude/PrelNames, which 
contains wired-in knowledge of which modules certain functions and data types 
live in.  Check the ones you've moved!

S

| -Original Message-
| From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users-
| boun...@haskell.org] On Behalf Of Johan Tibell
| Sent: 18 August 2011 15:45
| To: glasgow-haskell-users
| Subject: Can't find interface-file declaration for type constructor or class 
integer-
| gmp:GHC.Integer.Type.Integer
| 
| I'm trying to refactor the integer-gmp package to fix the breakage
| explained in #5384. During the refactoring I
| 
| * moved GHC.Integer.Type to GHC.Integer.GMP.Type, and
| * added a new GHC.Integer.Type module that re-exports parts of the
| interface now exposed by GHC.Integer.GMP.Type
| 
| The content of GHC.Integer.Type is just:
| 
| {-# LANGUAGE NoImplicitPrelude #-}
| {-# OPTIONS_HADDOCK hide #-}
| 
| -- If you change the module name or the export list you must update
| -- compiler/prelude/PrelNames.lhs.
| module GHC.Integer.Type (
|   Integer(..)
| , plusInteger
| , timesInteger
| , smallInteger
| , integerToWord
| , integerToInt
| , minusInteger
| , negateInteger
| , eqInteger
| , neqInteger
| , absInteger
| , signumInteger
| , leInteger
| , gtInteger
| , ltInteger
| , geInteger
| , compareInteger
| , gcdInteger
| , lcmInteger
| , andInteger
| , orInteger
| , xorInteger
| , complementInteger
| , shiftLInteger
| , shiftRInteger
| ) where
| 
| import GHC.Integer.GMP.Type
| 
| GHC doesn't seem to like this at all. It can no longer find the
| GHC.Integer.Type.Integer type:
| 
| $ inplace/bin/ghc-stage1   -H64m -O -fasm-package-name
| base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
| -ilibraries/base/dist-install/build
| -ilibraries/base/dist-install/build/autogen
| -Ilibraries/base/dist-install/build
| -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
| -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
| -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
| ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
| -package-name base -XHaskell98 -XCPP -O -dcore-lint
| -no-user-package-conf -rtsopts -odir
| libraries/base/dist-install/build -hidir
| libraries/base/dist-install/build -stubdir
| libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
| libraries/base/./Data/Maybe.hs -o
| libraries/base/dist-install/build/Data/Maybe.o
| 
| libraries/base/Data/Maybe.hs:70:13:
| Can't find interface-file declaration for type constructor or
| class integer-gmp:GHC.Integer.Type.Integer
|   Probable cause: bug in .hi-boot file, or inconsistent .hi file
|   Use -ddump-if-trace to get an idea of which file caused the error
| When deriving the instance for (Eq (Maybe a))
| 
| Here's the -ddump-if-trace log:
| 
| $ inplace/bin/ghc-stage1   -H64m -O -fasm-package-name
| base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
| -ilibraries/base/dist-install/build
| -ilibraries/base/dist-install/build/autogen
| -Ilibraries/base/dist-install/build
| -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
| -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
| -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
| ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
| -package-name base -XHaskell98 -XCPP -O -dcore-lint
| -no-user-package-conf -rtsopts -odir
| libraries/base/dist-install/build -hidir
| libraries/base/dist-install/build -stubdir
| libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
| libraries/base/./Data/Maybe.hs -o
| libraries/base/dist-install/build/Data/Maybe.o -ddump-if-trace
| FYI: cannont read old interface file:
| libraries/base/dist-install/build/Data/Maybe.hi: openBinaryFile:
| does not exist (No such file or directory)
| Considering whether to load base:GHC.Base
| Reading interface for base:GHC.Base;
| reason: GHC.Base is directly imported
| readIFace libraries/base/dist-install/build/GHC/Base.hi
| updating EPS_
| Considering whether to load ghc-prim:GHC.Generics
| Reading interface for ghc-prim:GHC.Generics;
| reason: GHC.Generics is directly imported
| readIFace /usr/local/google/src/ghc/libraries/ghc-prim/dist-
| install/build/GHC/Generics.hi
| updating EPS_
| updating EPS_
| Considering whether to load base:GHC.Base {- SYSTEM -}
| loadHiBootInterface base:Data.Maybe
| Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
| Reading interface for ghc-prim:GHC.Types;
| reason: Checking fixity for :
| readIFace /usr/local/google/src/ghc/libraries/ghc-prim/dist-
| install/build/GHC/Types.hi
| updating EPS_
| Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
| Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
| Starting fork { Declaration for Monad
| Loading decl for GHC.Base.Monad
| updating 

Re: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Johan Tibell
I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
no? Or does PrelNames have to contain the name of the module that
originally defined the type? Looking in the .hi file in question (the
one for GHC.Integer.Type) I can see both the export of Integer(..) and
the import of Integer(..) from GHC.Integer.GMP.Types.

On Thu, Aug 18, 2011 at 6:10 PM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 My guess is that you have not updated compiler/prelude/PrelNames, which 
 contains wired-in knowledge of which modules certain functions and data types 
 live in.  Check the ones you've moved!

 S

 | -Original Message-
 | From: glasgow-haskell-users-boun...@haskell.org 
 [mailto:glasgow-haskell-users-
 | boun...@haskell.org] On Behalf Of Johan Tibell
 | Sent: 18 August 2011 15:45
 | To: glasgow-haskell-users
 | Subject: Can't find interface-file declaration for type constructor or 
 class integer-
 | gmp:GHC.Integer.Type.Integer
 |
 | I'm trying to refactor the integer-gmp package to fix the breakage
 | explained in #5384. During the refactoring I
 |
 | * moved GHC.Integer.Type to GHC.Integer.GMP.Type, and
 | * added a new GHC.Integer.Type module that re-exports parts of the
 | interface now exposed by GHC.Integer.GMP.Type
 |
 | The content of GHC.Integer.Type is just:
 |
 | {-# LANGUAGE NoImplicitPrelude #-}
 | {-# OPTIONS_HADDOCK hide #-}
 |
 | -- If you change the module name or the export list you must update
 | -- compiler/prelude/PrelNames.lhs.
 | module GHC.Integer.Type (
 |       Integer(..)
 |     , plusInteger
 |     , timesInteger
 |     , smallInteger
 |     , integerToWord
 |     , integerToInt
 |     , minusInteger
 |     , negateInteger
 |     , eqInteger
 |     , neqInteger
 |     , absInteger
 |     , signumInteger
 |     , leInteger
 |     , gtInteger
 |     , ltInteger
 |     , geInteger
 |     , compareInteger
 |     , gcdInteger
 |     , lcmInteger
 |     , andInteger
 |     , orInteger
 |     , xorInteger
 |     , complementInteger
 |     , shiftLInteger
 |     , shiftRInteger
 |     ) where
 |
 | import GHC.Integer.GMP.Type
 |
 | GHC doesn't seem to like this at all. It can no longer find the
 | GHC.Integer.Type.Integer type:
 |
 | $ inplace/bin/ghc-stage1   -H64m -O -fasm    -package-name
 | base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
 | -ilibraries/base/dist-install/build
 | -ilibraries/base/dist-install/build/autogen
 | -Ilibraries/base/dist-install/build
 | -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
 | -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
 | -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
 | ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
 | -package-name base -XHaskell98 -XCPP -O -dcore-lint
 | -no-user-package-conf -rtsopts     -odir
 | libraries/base/dist-install/build -hidir
 | libraries/base/dist-install/build -stubdir
 | libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
 | libraries/base/./Data/Maybe.hs -o
 | libraries/base/dist-install/build/Data/Maybe.o
 |
 | libraries/base/Data/Maybe.hs:70:13:
 |     Can't find interface-file declaration for type constructor or
 | class integer-gmp:GHC.Integer.Type.Integer
 |       Probable cause: bug in .hi-boot file, or inconsistent .hi file
 |       Use -ddump-if-trace to get an idea of which file caused the error
 |     When deriving the instance for (Eq (Maybe a))
 |
 | Here's the -ddump-if-trace log:
 |
 | $ inplace/bin/ghc-stage1   -H64m -O -fasm    -package-name
 | base-4.4.0.0 -hide-all-packages -i -ilibraries/base/.
 | -ilibraries/base/dist-install/build
 | -ilibraries/base/dist-install/build/autogen
 | -Ilibraries/base/dist-install/build
 | -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
 | -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
 | -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
 | ghc-prim-0.2.0.0 -package integer-gmp-0.3.0.0 -package rts-1.0
 | -package-name base -XHaskell98 -XCPP -O -dcore-lint
 | -no-user-package-conf -rtsopts     -odir
 | libraries/base/dist-install/build -hidir
 | libraries/base/dist-install/build -stubdir
 | libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c
 | libraries/base/./Data/Maybe.hs -o
 | libraries/base/dist-install/build/Data/Maybe.o -ddump-if-trace
 | FYI: cannont read old interface file:
 |     libraries/base/dist-install/build/Data/Maybe.hi: openBinaryFile:
 | does not exist (No such file or directory)
 | Considering whether to load base:GHC.Base
 | Reading interface for base:GHC.Base;
 |     reason: GHC.Base is directly imported
 | readIFace libraries/base/dist-install/build/GHC/Base.hi
 | updating EPS_
 | Considering whether to load ghc-prim:GHC.Generics
 | Reading interface for ghc-prim:GHC.Generics;
 |     reason: GHC.Generics is directly imported
 | readIFace /usr/local/google/src/ghc/libraries/ghc-prim/dist-
 | install/build/GHC/Generics.hi
 | updating EPS_
 | updating EPS_
 | Considering whether to load 

RE: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Simon Peyton-Jones
| I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
| no? Or does PrelNames have to contain the name of the module that
| originally defined the type? 

Yes, exactly!

Simon


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Johan Tibell
On Thu, Aug 18, 2011 at 7:07 PM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 | I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
 | no? Or does PrelNames have to contain the name of the module that
 | originally defined the type?

 Yes, exactly!

This causes some trouble though, as the module named in PrelNames must
exist in both in integer-gmp and integer-simple i.e. it must be some
generic name like GHC.Integer.Type rather than a name containing e.g.
GMP. I could keep the data type definition where it is
(GHC.Integer.Type) but then I would have a hard time exporting it from
e.g. GHC.Integer.GMP.Internals without undoing Ian's patch which
removed the slightly odd GHC.Integer - GHC.Integer.GMP.Internals -
GHC.Integer.Type module dependency in integer-gmp.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: alternative to loadWithLogge

2011-08-18 Thread Judah Jacobson
On Tue, Aug 16, 2011 at 2:25 AM, Kazu Yamamoto k...@iij.ad.jp wrote:
 Hello,

 ghc-mod, IDE-like back-end for Emacs, uses warning related APIs
 including loadWithLogger and getWarnings in GHC 7.0.3 API. I found
 that they disappeared in GHC 7.2.1 API. What should I use to handle
 warnings in GHC 7.2.1 API?

You can set the log_action field of the session's DynFlags to a custom
handler.  Its value is

type LogAction = Severity - SrcSpan - PprStyle - Message - IO ()

The Severity parameter will let you tell whether a message is a
warning or an error.

Best,
-Judah

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Daniel Fischer
On Thursday 18 August 2011, 19:13:45, Johan Tibell wrote:
 On Thu, Aug 18, 2011 at 7:07 PM, Simon Peyton-Jones
 
 simo...@microsoft.com wrote:
  | I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
  | no? Or does PrelNames have to contain the name of the module that
  | originally defined the type?
  
  Yes, exactly!
 
 This causes some trouble though, as the module named in PrelNames must
 exist in both in integer-gmp and integer-simple i.e. it must be some
 generic name like GHC.Integer.Type 

GHC.Integer.Impl.Type ?

 rather than a name containing e.g.
 GMP. I could keep the data type definition where it is
 (GHC.Integer.Type) but then I would have a hard time exporting it from
 e.g. GHC.Integer.GMP.Internals without undoing Ian's patch which
 removed the slightly odd GHC.Integer - GHC.Integer.GMP.Internals -
 GHC.Integer.Type module dependency in integer-gmp.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Johan Tibell
On Thu, Aug 18, 2011 at 7:32 PM, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
 On Thursday 18 August 2011, 19:13:45, Johan Tibell wrote:
 On Thu, Aug 18, 2011 at 7:07 PM, Simon Peyton-Jones

 simo...@microsoft.com wrote:
  | I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
  | no? Or does PrelNames have to contain the name of the module that
  | originally defined the type?
 
  Yes, exactly!

 This causes some trouble though, as the module named in PrelNames must
 exist in both in integer-gmp and integer-simple i.e. it must be some
 generic name like GHC.Integer.Type

 GHC.Integer.Impl.Type ?

The problem is that we wan't to export the GMP specific constructors
under something like GHC.Integer.GMP.Something, but that introduces a
conceptually weird (according to Ian's patch) module dependency.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Simon Peyton-Jones
It's hard to know what Ian had in mind, but I'm sure he'll tell us when he gets 
back from holiday.

Meanwhile, yes, it is hard to reconcile
* The wish to have multiple implementations of Integer
* The wired-in knowledge that GHC has
* The desire to have optimising rewrite rules in client libraries

I suggested one approach in the ticket earlier today; there might be others.  
It might be good to figure out a good design before going much further into 
implementation.

Simon

|  -Original Message-
|  From: Johan Tibell [mailto:johan.tib...@gmail.com]
|  Sent: 18 August 2011 18:14
|  To: Simon Peyton-Jones
|  Cc: glasgow-haskell-users
|  Subject: Re: Can't find interface-file declaration for type constructor or 
class
|  integer-gmp:GHC.Integer.Type.Integer
|  
|  On Thu, Aug 18, 2011 at 7:07 PM, Simon Peyton-Jones
|  simo...@microsoft.com wrote:
|   | I shouldn't have to modify PrelNames since I kept GHC.Integer.Type,
|   | no? Or does PrelNames have to contain the name of the module that
|   | originally defined the type?
|  
|   Yes, exactly!
|  
|  This causes some trouble though, as the module named in PrelNames must
|  exist in both in integer-gmp and integer-simple i.e. it must be some
|  generic name like GHC.Integer.Type rather than a name containing e.g.
|  GMP. I could keep the data type definition where it is
|  (GHC.Integer.Type) but then I would have a hard time exporting it from
|  e.g. GHC.Integer.GMP.Internals without undoing Ian's patch which
|  removed the slightly odd GHC.Integer - GHC.Integer.GMP.Internals -
|  GHC.Integer.Type module dependency in integer-gmp.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users