ghc discards version of wired-in packages
If you invoke ghc with something like -hide-all-packages and then run it over a file like so:
import Prelude
import System.Process
main = putStrLn "hi"
GHC will tell you:
$ ghc -hide-all-packages test1.hs
test2.hs:1:0:
Failed to load interface for `Prelude':
it is a member of package base-3.0.3.0, which is hidden
But if you have a file like this which uses haskell98
module Main where
import System
import Prelude
main = do p <- getProgName
putStrLn $ "program name is " ++ p
And try to compile it, GHC says this:
$ ghc -hide-all-packages test2.hs
Main.hs:2:0:
Failed to load interface for `System':
it is a member of package haskell98, which is hidden
It does not report the version number of haskell98. There is a reason we want this: while hacking on David Roundy's build system franchise (darcs get http://darcs.net/repos/franchise/) I noticed that while the package built under GHC 6.10 (with a tweak or two,) it reported the franchise package as broken. However, when running ghc-pkg check I got this (very unhelpful) output:
$ ghc-pkg list franchise
/Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.0.20081007/./package.conf:
/Users/austinseipp/.ghc/i386-darwin-6.10.0.20081007/package.conf:
{franchise-0.0.3}
$
ghc-pkg check
package franchise-0.0.3 has missing dependencies:
$
This is the configuration file generated by franchise, for itself:
name: franchise
version: 0.0.3
license: BSD3
copyright: David Roundy
maintainer: ???
import-dirs: "/Users/austinseipp/lib/franchise-0.0.3/"
library-dirs: "/Users/austinseipp/lib/franchise-0.0.3/"
exposed-modules: Distribution.Franchise
hidden-modules: Distribution.Franchise.StringSet Distribution.Franchise.ConfigureState Distribution.Franchise.Util Distribution.Franchise.Buildable Distribution.Franchise.Ghc
hs-libraries: franchise
exposed: True
depends: haskell98, base-3.0.3.0, directory-1.0.0.2, process-1.0.1.0
The problem is:
depends: haskell98, base-3.0.3.0, directory-1.0.0.2, process-1.0.1.0
Should be:
depends: haskell98-1.0.1.0, base-3.0.3.0, directory-1.0.0.2, process-1.0.1.0
I tracked this down further by examining the source code; it seems as if franchise starts off by running 'ghc -hide-all-packages' over the source code repeatedly, gobbling up and parsing all of the 'package is hidden' errors until there are no more, and determining what packages are necessary and what version and using that as build info. But as GHC does not report the version number of haskell98, it simply emits 'depends: haskell98' and ghc-pkg reports it as broken!
Using a version of franchise with a patch of mine to show some debugging output, we can see this is the problem:
$ runghc Setup.hs configure
Configuring...
"\nDistribution/Franchise/ConfigureState.hs:66:7:\n Could not find module `Maybe':\n it is a member of package haskell98, which is hidden\n"
adding ["haskell98"]
"\nDistribution/Franchise/ConfigureState.hs:63:7:\n Could not find module `System.Console.GetOpt':\n it is a member of package base-3.0.3.0, which is hidden\n"
adding ["base-3.0.3.0"]
"\nDistribution/Franchise/ConfigureState.hs:60:7:\n Could not find module `System.Directory':\n it is a member of package directory-1.0.0.2, which is hidden\n"
adding ["directory-1.0.0.2"]
"\nDistribution/Franchise/Util.hs:46:7:\n Could not find module `System.Process':\n it is a member of package process-1.0.1.0, which is hidden\n"
adding ["process-1.0.1.0"]
Added packages haskell98 base-3.0.3.0 directory-1.0.0.2 process-1.0.1.0...
Configure successful.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |