Description

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:

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.

Oldest firstNewest firstThreaded

Comments only

Change History (9)

I'll also mention that while this happens, we will likely have to resort to simply checking if there is no version tag, and if not, checking ghc-pkg output and finding the proper package version to use and emit that the configuration file we register with ghc-pkg.

It also means that until we implement this or this gets fixed, any library built with franchise that depends on haskell98 will be reported as broken by ghc-pkg (although it really probably isn't, and ghc-pkg check will be of no help.)

Me and David are thinking about some ways in which we can solve the problem, since right now that particular part of the configuration code is a little weak. It works fine for right now, but of course we'll likely go with something more robust in the future.

Also, I can confirm a package with unversioned dependencies can be registered (for any dependency) with 'ghc-pkg register' without --force or any error output on the 6.10 RC1, so I'm not sure what's going on either.

Also, I can confirm a package with unversioned dependencies can be registered (for any dependency) with 'ghc-pkg register' without --force or any error output on the 6.10 RC1, so I'm not sure what's going on either.