
On Unix-like OSes: If I run "ghc test.hs" and then run "ghci test.hs", ghci fails to load up my code. I have to touch test.hs and then run ghci. I can understand ghci refusing to recompile something it thinks it has already compiled. But it appears to refuse to load it into an interactive session - which is less useful. In fact, removing test.hi makes ghci work again. This is ghc 6.6. Anyone else seeing this? -- Dan

Hi Dan, On Fri, Jul 20, 2007 at 02:12:12PM -0700, Dan Piponi wrote:
On Unix-like OSes:
If I run "ghc test.hs" and then run "ghci test.hs", ghci fails to load up my code. I have to touch test.hs and then run ghci. I can understand ghci refusing to recompile something it thinks it has already compiled. But it appears to refuse to load it into an interactive session - which is less useful. In fact, removing test.hi makes ghci work again.
This is ghc 6.6. Anyone else seeing this?
Seems to work for me, on Linux/amd64: $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.6 $ echo 'main = putStrLn "Foo"' > q.hs $ ghc q.hs $ ghci -v0 q.hs Prelude Main> main Foo Prelude Main> Can you please give a complete testcase for the problem you're seeing? Also, exactly which OS/arch are you on? Thanks Ian

Ian said:
Can you please give a complete testcase for the problem you're seeing?
I took my test case and started deleting lines from it to simplify it. And now I'm not seeing the problem at all and I can't reproduce it, even though when I originally posted I was getting it repeatably. I'm either hallucinating or it's a problem that comes up intermittently. Maybe it's some kind of network time skew issue that has nothing to do with ghc. If I catch it happening again I'll make sure to do more investigation. -- Dan

On Mon, Jul 23, 2007 at 11:46:41AM -0700, Dan Piponi wrote:
Ian said:
Can you please give a complete testcase for the problem you're seeing?
I took my test case and started deleting lines from it to simplify it. And now I'm not seeing the problem at all and I can't reproduce it, even though when I originally posted I was getting it repeatably. I'm either hallucinating or it's a problem that comes up intermittently. Maybe it's some kind of network time skew issue that has nothing to do with ghc. If I catch it happening again I'll make sure to do more investigation.
GHC 6.6 had some kind of memory allocation bug that led to all kind of weird errors in GHCi. Maybe try 6.6.1 ? Phil -- http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

Several months late I now have a simple test case for what I think is either a GHC bug or a "misexpectation" on my part. This is with GHC 6.8.1 and I've tested both under Linux and MacOSX. It took a while to reproduce it because I thought the problem had gone away, but actually I'd just misunderstood when it happens. Here's a transcript of a complete session with a shell to make it easy to reproduce. Note how on the second run, ghci behaves differently. --------------------------------------
cat > bug.hs x = 1
main = do print x
ghci bug.hs GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling Main ( bug.hs, interpreted ) Ok, modules loaded: Main. *Main> main 1 *Main> x 1 *Main> :q Leaving GHCi. ghc bug.hs ghci bug.hs GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Ok, modules loaded: Main. Prelude Main> main 1 Prelude Main> x
<interactive>:1:0: Not in scope: `x'
Prelude Main> Leaving GHCi.
-----------------------------------------------
On Jul 23, 2007 10:46 AM, Dan Piponi
Ian said:
Can you please give a complete testcase for the problem you're seeing?

Dan Piponi wrote:
Several months late I now have a simple test case for what I think is either a GHC bug or a "misexpectation" on my part.
Here's what it looks like to me. If there is a .hi and .o file sitting around for a module, then GHCi will load it in compiled mode, and only let you access those symbols that are exported by the .hi file. If you compile a source file that has no module header, it compiles to the module Main and *only* exports the symbol main. You can fix it by adding a module header explicitly, or by deleting either the .hi or .o file. This is not new with GHC 6.8. For example, it's why I had to sneakily add a module declaration to the top of a source file when I wrote
http://www.haskell.org/haskellwiki/Learn_Haskell_in_10_minutes#Function_defi...
-- Chris Smith

On Mon, 12 Nov 2007, Chris Smith wrote:
Dan Piponi wrote:
Several months late I now have a simple test case for what I think is either a GHC bug or a "misexpectation" on my part.
Here's what it looks like to me.
If there is a .hi and .o file sitting around for a module, then GHCi will load it in compiled mode, and only let you access those symbols that are exported by the .hi file. If you compile a source file that has no module header, it compiles to the module Main and *only* exports the symbol main. You can fix it by adding a module header explicitly, or by deleting either the .hi or .o file.
See http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluati...

On Nov 12, 2007 1:59 PM, Henning Thielemann
See http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluati...
I guess the key sentence is: "For technical reasons, GHCi can only support the *-form for modules which are interpreted, so compiled modules and package modules can only contribute their exports to the current scope." But it does mean the interpreter isn't referentially transparent, which is weird for a language that puts so much stress on referential transparency. -- Dan

"For technical reasons, GHCi can only support the *-form for modules which are interpreted, so compiled modules and package modules can only contribute their exports to the current scope." But it does mean the interpreter isn't referentially transparent, which is weird for a language that puts so much stress on referential transparency.
iirc, you can use -fforce-recomp with GHCi, to make it look for sources, ignoring compiled code, if that is what you want: http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation... claus

| "For technical reasons, GHCi can only support the *-form for modules | which are interpreted, so compiled modules and package modules can | only contribute their exports to the current scope." But it does mean | the interpreter isn't referentially transparent, which is weird for a | language that puts so much stress on referential transparency. Well it depends on what you mean by "referential transparency" -- but I'll agree 100% that the behaviour you described in your original message is surprising, and therefore unwelcome. Nevertheless, I think there's a good reason for it. The "technical reasons" are not just laziness on our part. By exporting only the functions named in the export list, GHC can inline everything else vigorously, and that can in turn give big performance improvements. We don't want to arrange that every top-level definition is treated as exported *just in case* someone wants to GHCi that module. This is behaviour that could be changed. E.g. we could say that the top-level scope remains available unless you optimise with -O2. Or something. But there has to be a surprise lurking somewhere. It's just another of those things on GHC's now-large surface area that could probably be improved if someone sat down and thought about it carefully. Meanwhile, though, the best we can do is improve the documentation: Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling? Simon

On Tue, 13 Nov 2007, Simon Peyton-Jones wrote:
Meanwhile, though, the best we can do is improve the documentation:
Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling?
... or even better - words that GHCi can say, when it loads modules?

On Nov 13, 2007 3:00 AM, Simon Peyton-Jones
Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling?
I guess the thing that would have helped best would have been an error message like "'x' not in scope, use -fforce-recomp to see all symbols" when running interactively in ghci with a previously compiled top level module. -- Dan

On Nov 13, 2007, at 13:32 , Dan Piponi wrote:
On Nov 13, 2007 3:00 AM, Simon Peyton-Jones
wrote: Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling?
I guess the thing that would have helped best would have been an error message like "'x' not in scope, use -fforce-recomp to see all symbols" when running interactively in ghci with a previously compiled top level module.
FWIW, I'm thinking the right thing to do is -fforce-recomp explicitly loaded (:l) modules by default, with documentation specifying to -fno- force-recomp if you don't want that for some reason. If you're using ghci, most of the time you *don't* want the normal ghc symbol behavior. (The above would still be useful, if you then switched to a module pulled in by the explicitly loaaded one and tried to work with a non- exported symbol. I do that a fair bit when developing/debugging.) -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

| > Dan, can you suggest any words we could add to the | > documentation that would have prevented you stumbling? | | I guess the thing that would have helped best would have been an error | message like "'x' not in scope, use -fforce-recomp to see all symbols" | when running interactively in ghci with a previously compiled top | level module. I agree that an informative error message is worth 100 manual pages. The trouble is that at this stage GHCi doesn't even *know* that 'x' ever existed, because it's not mentioned in the interface file, so it's hard to do even give the error message you suggest. (I forgot to mention that GHCi will let you run code in modules that are only available in compiled form, such as ones from other packages -- there is no source code to consult.) I can think of some other possibilities: (a) It would be possible to record in the .hi file the fact that there originally *was* a top-level 'x', and so produce the message you suggest. But it'd be one more thing to implement, document, and maintain. (b) We could decide *never* to use compiled modules (M.o) for home-package modules, but only for other-package modules. Then at least all the home-package modules would have their names in scope. So the home package would be always interpreted. (The home package is the modules of your current project, not installed as a "package".) This'd be pretty easy. (c) The last thing I can think of is that we could *read the source code* for home-package modules M (to find the top-level definitions), but still use the M.o files if they exist (to get faster execution). Then we could produce the message you suggest. If any of this seems important enough to you to be worth doing, would you like to create a feature-request ticket for it, and summarise the discussion and alternatives? Simon

Hello Simon, Wednesday, November 14, 2007, 11:28:23 AM, you wrote:
I can think of some other possibilities:
(a) It would be possible to record in the .hi file the fact that there originally *was* a top-level 'x', and so produce the message you suggest. But it'd be one more thing to implement, document, and maintain.
and this will increase amount of recompilation for large projects
(b) We could decide *never* to use compiled modules (M.o) for home-package modules, but only for other-package modules. Then at least all the home-package modules would have their names in scope. So the home package would be always interpreted. (The home package is the modules of your current project, not installed as a "package".) This'd be pretty easy.
it may be great if such behavior enabled by some option, such as -force-recomp. in many cases, we need to run compiled code inside ghci how about such variant? d) when printing message about undefined symbol, add note about reloading sources: "Symbol `x` undefined; if it's a top-level symbol in some loaded module M, please reload this module source-wise: :load M.hs" and implement directive ":load M.hs" as interpreted loading of the module -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Nov 14, 2007, at 3:28 , Simon Peyton-Jones wrote:
I agree that an informative error message is worth 100 manual pages. The trouble is that at this stage GHCi doesn't even *know* that 'x' ever existed, because it's not mentioned in the interface file, so it's hard to do even give the error message you suggest.
Not really. Include the hint on the first "symbol not found" error after loading a binary module as a "Perhaps you need to -fforce- recomp?"; it doesn't really matter if it turns out the symbol-not- found was actually e.g. a typo. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

2007/11/13, Simon Peyton-Jones
| "For technical reasons, GHCi can only support the *-form for modules | which are interpreted, so compiled modules and package modules can | only contribute their exports to the current scope." But it does mean | the interpreter isn't referentially transparent, which is weird for a | language that puts so much stress on referential transparency.
Well it depends on what you mean by "referential transparency" -- but I'll agree 100% that the behaviour you described in your original message is surprising, and therefore unwelcome.
Plus, I just discovered, by reading this thread, WHY this happen.
Meanwhile, though, the best we can do is improve the documentation:
Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling?
Granted, I'm lazy. I read release notes only and only few first pages to see what's new. Couldn't GHCI be improved to at least give some hints? Cheers, Radek.

Granted, I'm lazy. I read release notes only and only few first pages to see what's new. Couldn't GHCI be improved to at least give some hints?
it does!-) watch the prompt, which says '*M>', if all of M's top-level is in scope, or 'M>', if only M's exports are in scope. check here: http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluati... claus ------------------------- notice how in this example session, the ghci prompt before compilation is '*Main>', whereas it is 'Prelude Main>' after compilation (ghci adds the Prelude because otherwise only 'main' would be in scope): ------------------------- $ ghcii.sh u.hs ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. [1 of 1] Compiling Main ( u.hs, interpreted ) Ok, modules loaded: Main. *Main> :q Leaving GHCi. $ ghc --make u [1 of 1] Compiling Main ( u.hs, u.o ) Linking u.exe ... $ ghcii.sh u.hs ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Ok, modules loaded: Main. Prelude Main> :q Leaving GHCi.

Claim: The "ghci modulename" and ":load modulename" command are confusing because they have two behaviors. Short form of my proposal: Make two separate commands that each have a predictable behavior. Make "ghci modulename" default to source loading, and require a flag to load a binary. I don't give a bikeshed what they are called. I don't care if the magic ":load" stays or goes or ends up with only one behavior. This is different/orthogonal to the .o or .hs file extension sensitive proposal. My arguments: I run into annoyances because I often poke at things in ghci when trying to get my package to compile. So depending on which modules succeeded or failed to compile I get different behavior when loading into ghci. I am no longer confused by this, but just annoyed. I would say that the user gets surprised which leads to feeling that there is a lack of control. The '*' in the '*Main>' versus 'Main>' prompt is a UI feature for experts, not for new users. Making this more obvious or verbose or better documented does not fix the lack of control the user feels. The only flags that the user can easily find are those listed by --help:
chrisk$ ghci --help Usage:
ghci [command-line-options-and-input-files]
The kinds of input files that can be given on the command-line include:
- Haskell source files (.hs or .lhs suffix) - Object files (.o suffix, or .obj on Windows) - Dynamic libraries (.so suffix, or .dll on Windows)
In addition, ghci accepts most of the command-line options that plain GHC does. Some of the options that are commonly used are:
-fglasgow-exts Allow Glasgow extensions (unboxed types, etc.)
-i<dir> Search for imported modules in the directory <dir>.
-H32m Increase GHC's default heap size to 32m
-cpp Enable CPP processing of source files
Full details can be found in the User's Guide, an online copy of which can be found here:
The -fforce-recomp and -fno-force-recomp flags only exist in the User's Guide. Thus they are hard to find. Is there a ticket open for adding at least a list of the recognized flags to ghc and ghci usage messages? Ideally, I want a ":load modulename" to get the source and a ":bin modulename" to get the binary (and a ":m ..." to get the binary). I want "ghci modulename" to get the source and "ghch -bin modulename" to get the binary. Simple and predictable and no surprises. Cheers, Chris K

I was also bitten by this. I consider it to be a serious problem with the UI for ghci. My vote is: o The default should be to make all symbols available whenever possible. o It should be easy for experts, like Aaron Denney, to get the current behavior. (E.g., a flag, that can be turned on or off at the ghci command, during a session, or as the local default in dot-ghci.) o Whenever it is not possible to make all symbols available, give the user a clear warning. I don't think it's necessary to go overboard with details in the warning. A simple, clear, generic warning at load time is enough. For example: If we looked for the source code and did not find it, this might be a beginner who accidentally deleted it. So we say: "Module 'Foo' loaded. Warning: Source code not found for 'Foo', so only its exported symbols are available." If it was requested, we say: "Module 'Foo' loaded. Only the compiled module was loaded, as requested, so only its exported symbols are available." So someone who requested this in error will realize that. Experts should be able to turn off this message - but not the previous one - and rely upon the subtle hint in the command prompt. These give enough information that anyone who gets into the wrong situation by mistake will know (or be able to figure out) exactly what happened. Thanks, Yitz

It's worth saying that right now, all you have to do to get the source file loaded is
:! touch M.hs :reload
Put this in a macro, if you want:
:def src \s -> return (":! touch "++s)
I hear the arguments in this thread, and others have suggested changes before: http://hackage.haskell.org/trac/ghc/ticket/1205 http://hackage.haskell.org/trac/ghc/ticket/1439 One of the suggestions was that if you name the source file rather than the module name, you get the source file loaded for that file, and any object code is ignored. So any files you explicitly want to have full top-level scope for must be named in :load or on the GHCi command line. The only problem with this is that someone who isn't aware of this convention might accidentally be ignoring compiled code, or might wonder why their compiled code isn't being used. Well, perhaps this is less confusing than the current behaviour; personally I find the current behaviour consistent and easy to understand, but I guess I'm in the minority! The other suggestion is to have a variant of :load that ignores compiled code (or for :load to do that by default, and rename the current :load to something else). I don't have a strong preference. Cheers, Simon
Short form of my proposal: Make two separate commands that each have a predictable behavior. Make "ghci modulename" default to source loading, and require a flag to load a binary. I don't give a bikeshed what they are called. I don't care if the magic ":load" stays or goes or ends up with only one behavior.
This is different/orthogonal to the .o or .hs file extension sensitive proposal.
My arguments:
I run into annoyances because I often poke at things in ghci when trying to get my package to compile. So depending on which modules succeeded or failed to compile I get different behavior when loading into ghci. I am no longer confused by this, but just annoyed.
I would say that the user gets surprised which leads to feeling that there is a lack of control.
The '*' in the '*Main>' versus 'Main>' prompt is a UI feature for experts, not for new users. Making this more obvious or verbose or better documented does not fix the lack of control the user feels.
The only flags that the user can easily find are those listed by --help:
chrisk$ ghci --help Usage:
ghci [command-line-options-and-input-files]
The kinds of input files that can be given on the command-line include:
- Haskell source files (.hs or .lhs suffix) - Object files (.o suffix, or .obj on Windows) - Dynamic libraries (.so suffix, or .dll on Windows)
In addition, ghci accepts most of the command-line options that plain GHC does. Some of the options that are commonly used are:
-fglasgow-exts Allow Glasgow extensions (unboxed types, etc.)
-i<dir> Search for imported modules in the directory <dir>.
-H32m Increase GHC's default heap size to 32m
-cpp Enable CPP processing of source files
Full details can be found in the User's Guide, an online copy of which can be found here:
The -fforce-recomp and -fno-force-recomp flags only exist in the User's Guide. Thus they are hard to find. Is there a ticket open for adding at least a list of the recognized flags to ghc and ghci usage messages?
Ideally, I want a ":load modulename" to get the source and a ":bin modulename" to get the binary (and a ":m ..." to get the binary). I want "ghci modulename" to get the source and "ghch -bin modulename" to get the binary. Simple and predictable and no surprises.
Cheers, Chris K

Simon Marlow wrote:
The only problem with this is that someone who isn't aware of this convention might accidentally be ignoring compiled code, or might wonder why their compiled code isn't being used. Well, perhaps this is less confusing than the current behaviour; personally I find the current behaviour consistent and easy to understand, but I guess I'm in the minority!
Anecdotes have little value, but for what it's worth: in around 5 years of ghc use, I have never, not even once, wanted to load the module I was working on in its compiled form. I've occasionally noticed that dependent modules get loaded quickly from their .o's and thought that was handy, but that's all. During that time I have many times been annoyed that a .hs file which I load from the command line or via :load (or via C-c C-l in emacs mode) get loaded in interpreted form :) Jules

On Thu, 15 Nov 2007, Jules Bean wrote:
Anecdotes have little value, but for what it's worth: in around 5 years of ghc use, I have never, not even once, wanted to load the module I was working on in its compiled form. I've occasionally noticed that dependent modules get loaded quickly from their .o's and thought that was handy, but that's all. During that time I have many times been annoyed that a .hs file which I load from the command line or via :load (or via C-c C-l in emacs mode) get loaded in interpreted form :)
I found compiled modules useful in GHCi when using computation intensive functions, like those for signal processing.

Simon Peyton-Jones wrote:
| "For technical reasons, GHCi can only support the *-form for modules | which are interpreted, so compiled modules and package modules can | only contribute their exports to the current scope." But it does mean | the interpreter isn't referentially transparent, which is weird for a | language that puts so much stress on referential transparency.
Well it depends on what you mean by "referential transparency" -- but I'll agree 100% that the behaviour you described in your original message is surprising, and therefore unwelcome.
Nevertheless, I think there's a good reason for it. The "technical reasons" are not just laziness on our part. By exporting only the functions named in the export list, GHC can inline everything else vigorously, and that can in turn give big performance improvements. We don't want to arrange that every top-level definition is treated as exported *just in case* someone wants to GHCi that module.
This is behaviour that could be changed. E.g. we could say that the top-level scope remains available unless you optimise with -O2. Or something. But there has to be a surprise lurking somewhere.
I don't suggest a change to your ABI or anything like that. I just suggest that the interpreter - ghci - should, by default, always load a ".hs" file in interpreted mode, ignoring the .hi and .o already present. After all, a ".hs" file contains source code and ghci is a source code interpreter; I submit this would be the least surprising thing to do. When it loads dependent modules, I think it can safely load the .o/.hi versions as it does now if they exist, since we don't expect full symbol table access there. Jules

On 2007-11-13, Jules Bean
Simon Peyton-Jones wrote:
| "For technical reasons, GHCi can only support the *-form for modules | which are interpreted, so compiled modules and package modules can | only contribute their exports to the current scope." But it does mean | the interpreter isn't referentially transparent, which is weird for a | language that puts so much stress on referential transparency.
Well it depends on what you mean by "referential transparency" -- but I'll agree 100% that the behaviour you described in your original message is surprising, and therefore unwelcome.
Nevertheless, I think there's a good reason for it. The "technical reasons" are not just laziness on our part. By exporting only the functions named in the export list, GHC can inline everything else vigorously, and that can in turn give big performance improvements. We don't want to arrange that every top-level definition is treated as exported *just in case* someone wants to GHCi that module.
This is behaviour that could be changed. E.g. we could say that the top-level scope remains available unless you optimise with -O2. Or something. But there has to be a surprise lurking somewhere.
I don't suggest a change to your ABI or anything like that.
I just suggest that the interpreter - ghci - should, by default, always load a ".hs" file in interpreted mode, ignoring the .hi and .o already present. After all, a ".hs" file contains source code and ghci is a source code interpreter; I submit this would be the least surprising thing to do.
When it loads dependent modules, I think it can safely load the .o/.hi versions as it does now if they exist, since we don't expect full symbol table access there.
I _like_ being able to interactively apply bits of code, whether compiled or not, and I like being able to compile them and get it to go faster. This would be a step back, for me. -- Aaron Denney -><-

Aaron Denney wrote:
On 2007-11-13, Jules Bean
wrote: Simon Peyton-Jones wrote:
| "For technical reasons, GHCi can only support the *-form for modules | which are interpreted, so compiled modules and package modules can | only contribute their exports to the current scope." But it does mean | the interpreter isn't referentially transparent, which is weird for a | language that puts so much stress on referential transparency.
Well it depends on what you mean by "referential transparency" -- but I'll agree 100% that the behaviour you described in your original message is surprising, and therefore unwelcome.
Nevertheless, I think there's a good reason for it. The "technical reasons" are not just laziness on our part. By exporting only the functions named in the export list, GHC can inline everything else vigorously, and that can in turn give big performance improvements. We don't want to arrange that every top-level definition is treated as exported *just in case* someone wants to GHCi that module.
This is behaviour that could be changed. E.g. we could say that the top-level scope remains available unless you optimise with -O2. Or something. But there has to be a surprise lurking somewhere. I don't suggest a change to your ABI or anything like that.
I just suggest that the interpreter - ghci - should, by default, always load a ".hs" file in interpreted mode, ignoring the .hi and .o already present. After all, a ".hs" file contains source code and ghci is a source code interpreter; I submit this would be the least surprising thing to do.
When it loads dependent modules, I think it can safely load the .o/.hi versions as it does now if they exist, since we don't expect full symbol table access there.
I _like_ being able to interactively apply bits of code, whether compiled or not, and I like being able to compile them and get it to go faster. This would be a step back, for me.
Just to be clear: my proposal is that if you want it to go faster you do ghci foo.hi or ghci foo.o ... so you still have the option to run on compiled code. My suggestion is simply that "ghci foo.hs" is an instruction to load source code (similarly :load); while "ghci foo.o" is obviously an instruction to load compiled code. Jules

On 13 Nov 2007, at 11:03 PM, Jules Bean wrote:
Just to be clear: my proposal is that if you want it to go faster you do
ghci foo.hi
or
ghci foo.o
... so you still have the option to run on compiled code.
My suggestion is simply that "ghci foo.hs" is an instruction to load source code (similarly :load); while "ghci foo.o" is obviously an instruction to load compiled code.
Even just having :m + *Foo always interpret Foo (giving an error only if the source isn't installed) would be an improvement. And wouldn't alter any /non-error/ behavior that exists now. jcc

Jonathan Cast wrote:
On 13 Nov 2007, at 11:03 PM, Jules Bean wrote:
Just to be clear: my proposal is that if you want it to go faster you do
ghci foo.hi
or
ghci foo.o
... so you still have the option to run on compiled code.
My suggestion is simply that "ghci foo.hs" is an instruction to load source code (similarly :load); while "ghci foo.o" is obviously an instruction to load compiled code.
Even just having
:m + *Foo
Currently :m doesn't load any modules, it just alters the "context" (what's in scope at the prompt), and fails if you ask for a module that isn't loaded. It would make sense for :m +M to behave like :add if M wasn't loaded, though. And perhaps :add *M or :load *M should ignore compiled code for M - that's another option. Cheers, Simon

This is ghc 6.6. Anyone else seeing this? not here.
what do these output: ghc --version and ghci --version ? are they different? besides that.. why do you use 6.6? may it bee.. is your "Unix-like OS" sth between OSX and linux? (i remenber there exists a Gnu/Darwin package manager without the (faster bootstrapping) ghc-6.6.1) - marc Am Freitag, 20. Juli 2007 23:12 schrieb Dan Piponi:
On Unix-like OSes:
If I run "ghc test.hs" and then run "ghci test.hs", ghci fails to load up my code. I have to touch test.hs and then run ghci. I can understand ghci refusing to recompile something it thinks it has already compiled. But it appears to refuse to load it into an interactive session - which is less useful. In fact, removing test.hi makes ghci work again.
This is ghc 6.6. Anyone else seeing this? -- Dan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I can give the following partial explanation. When you run "ghc test.hs" it compiles your test file and produces some auxiliar files at the same time. When you run ghci afterwards, if the mod. date of the auxiliar files is more recent than that of the source file, it directly loads the object code form of the source file. So it appears that ghci is having trouble when loading the object code version. Whereas if it's not, it loads the module interpreted. Of course, if you remove test.hi, ghci will always load the file interpreted, and so the problem doesn't manifest. Cheers pepe On 20/07/2007, at 23:12, Dan Piponi wrote:
On Unix-like OSes:
If I run "ghc test.hs" and then run "ghci test.hs", ghci fails to load up my code. I have to touch test.hs and then run ghci. I can understand ghci refusing to recompile something it thinks it has already compiled. But it appears to refuse to load it into an interactive session - which is less useful. In fact, removing test.hi makes ghci work again.
This is ghc 6.6. Anyone else seeing this? -- Dan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (18)
-
Aaron Denney
-
Brandon S. Allbery KF8NH
-
Bulat Ziganshin
-
Chris Smith
-
ChrisK
-
Claus Reinke
-
Dan Piponi
-
Henning Thielemann
-
Ian Lynagh
-
Jonathan Cast
-
Jules Bean
-
Marc A. Ziegert
-
Pepe Iborra
-
Philip Armstrong
-
Radosław Grzanka
-
Simon Marlow
-
Simon Peyton-Jones
-
Yitzchak Gale