[jhc] confusion on library source

David Roundy roundyd at physics.oregonstate.edu
Sat Aug 29 12:55:11 EDT 2009


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

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.

And finally, I think I've got a bug report.  If I specify -p haskell98
on the jhc command line, I get an error like:

$ jhc -p haskell98 enfranchise.hs
jhc -p haskell98 enfranchise.hs
jhc 0.7.1 (0.7.1-0)
Finding Dependencies...
Using Ho Cache: '/mnt/home/droundy/.jhc/cache'
Module 'Array' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'CPUTime' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Char' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Complex' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Directory' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'IO' is exported by multiple libraries: ["haskell98-1.0","haskell98-1.0"]
Module 'Ix' is exported by multiple libraries: ["haskell98-1.0","haskell98-1.0"]
Module 'List' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Locale' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Maybe' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Monad' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Random' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Ratio' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
Module 'Time' is exported by multiple libraries:
["haskell98-1.0","haskell98-1.0"]
There were conflicting modules!

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.
-- 
David Roundy


More information about the jhc mailing list