[jhc] confusion on library source
John Meacham
john at repetae.net
Sat Aug 29 18:58:12 EDT 2009
On Sat, Aug 29, 2009 at 12:55:11PM -0400, David Roundy wrote:
> Hello,
>
> I'm still looking into jhc, and am a little confused in trying to
> locate library source. Actually, I have a couple of questions.
>
> First, is there any way to query jhc to find out which libraries (or
> packages) export a given module? I'm getting errors like:
>
> Error: Module not found: Control.Concurrent
> Error: Module not found: Data.Version
> Error: Module not found: System.Exit
> Error: Module not found: System.Process
right now the easiest way is to do a --show-ho on the .hl file. However,
I would like to have an extended --list-libraries command at some point
that spits out all the meta-info in a machine readable format.
> I'm sure some of these just aren't present at all (since I've only got
> the five libraries that come with jhc), but I can't see how to be
> certain. And if I get more libraries, the puzzle seems likely only to
> get trickier. Of course, this would also be useful for teaching
> franchise to compile using jhc, since I'd like franchise to be able to
> guess which packages to install, so I won't have to do this in the
> future.
>
> Secondly, I'm very puzzled in looking at the lib/ source, as the
> libraries seem to use modules that are nowhere defined. For instance:
>
> $ cat lib/haskell98/System.hs
> module System (
> ExitCode(ExitSuccess,ExitFailure),
> getArgs, getProgName, getEnv, system, exitWith, exitFailure
> ) where
>
> import System.Exit
> import System.Environment
> import System.Cmd
>
> So it looks like System.Exit should exist somewhere. But I can't for
> the life of me (or the grep of me...) figure out where. :( I had
> been thinking that adding System.Exit would be an easy way to
> contribute a bit towards jhc, and at the same time learn a bit about
> how jhc works. Is System.Exit defined somewhere? If so, how can I
> convince jhc to use it in my code? I am very puzzled.
Ah, that is because the haskell98 package is the one pulled straight
from the darcs repo that ghc uses. In jhc, System is provided by base,
so is in lib/base/System.hs, the System provided by haskell98 is
ignored.
> Perhaps a simple nub would suffice? Is there ever a reason to import
> the same library twice? I suppose you could argue that this was my
> mistake, and jhc rightly rebuked me, but in that case a simpler error
> message would seem appropriate.
Ah, yes. this is also a bug. thanks for the report!
In general, jhc has not been well tested in situations other than what I
use it for, so chances are, if you see something odd, it is a bug, not a
design decision :)
John
--
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
More information about the jhc
mailing list