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
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/
On Sat, Aug 29, 2009 at 6:58 PM, John Meacham
$ 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.
Would it be feasible/desirable for me to split lib/base/System.hs into System.Exit, System.Environment and System.Cmd? It would make a few more of my programs more easily usable, and then we could use the System.hs from the haskell98 package. Thanks! -- David Roundy
On Sun, Aug 30, 2009 at 09:56:38AM -0400, David Roundy wrote:
On Sat, Aug 29, 2009 at 6:58 PM, John Meacham
wrote: $ 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.
Would it be feasible/desirable for me to split lib/base/System.hs into System.Exit, System.Environment and System.Cmd? It would make a few more of my programs more easily usable, and then we could use the System.hs from the haskell98 package. Thanks!
That would be quite useful. In general, the libraries need a lot of work. Compatibility with GHC where it makes sense is a useful thing. I am busy working on the back end and memory use of the generated code at the moment, but if someone out there wanted to help improve the libraries that would be great. Porting documentation to the jhc libs from the ghc repo would also be pretty straightforward and useful. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
participants (2)
-
David Roundy -
John Meacham