[GHC] #1205: ghci reports functions not in scope after loading a .hs, if there is a .o present

GHC trac at galois.com
Tue Mar 6 18:37:21 EST 2007


#1205: ghci reports functions not in scope after loading a .hs, if there is a .o
present
------------------------+---------------------------------------------------
    Reporter:  guest    |       Owner:         
        Type:  bug      |      Status:  new    
    Priority:  normal   |   Milestone:         
   Component:  GHCi     |     Version:  6.6    
    Severity:  normal   |    Keywords:         
  Difficulty:  Unknown  |    Testcase:         
Architecture:  Unknown  |          Os:  Unknown
------------------------+---------------------------------------------------
I wanted to debug some code, so I fired up ghci and had this experience:

 {{{
 > :l foo.hs
 ...
 > my_func 1 2 3

 <interactive>:1:0: Not in scope: `my_func'
 }}}

 Apparently, this was because I had previously compiled the code, and ghci
 noticed the .o file and loaded that instead of the source file.  As a
 result, anything not explicitly exported was not visible.

 Once I quit, removed the .o, restarted ghci, and reloaded the file; it
 worked as I was expecting.


 It seems to me that ":load foo.hs" should load foo.hs, with no funny
 business.  Anything else is likely not doing what the user expects.  I'd
 be fine with ":l foo" loading a compiled version if available, and I'm
 fine with imports from the code I'm loading a compiled version.  But, when
 I explicitly say to load one file, and some other file is loaded instead;
 that seems like bad behavior.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1205>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list