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

Claus Reinke claus.reinke at talk21.com
Wed Mar 7 15:46:07 EST 2007


it seems one can work around this issue by using -no-recomp (was this option
renamed, to -force-recomp, in newer ghcs?):

    $ ghc -e ":t hello" Main.hs
    hello :: [Char]

    $ ghc --make Main.hs
    Chasing modules from: Main.hs
    Compiling World            ( ./World.hs, ./World.o )
    Compiling Main             ( Main.hs, Main.o )
    Linking ...

    $ ghc -e ":t hello" Main.hs

    <interactive>:1:0: Not in scope: `hello'

    $ ghc -no-recomp -e ":t hello" Main.hs
    hello :: [Char]

so ghci -no-recomp behaves as one might expect ghci to behave (although this
prevents any use of compiled code in that session..).

claus

----- Original Message ----- 
From: "Lennart Augustsson" <lennart at augustsson.net>
To: <glasgow-haskell-bugs at haskell.org>
Sent: Wednesday, March 07, 2007 8:01 PM
Subject: Re: [GHC] #1205: ghci reports functions not in scope after loadinga .hs, if there is a .o 
present


> Personally, I find it very counter-intuitive that asking for Foo.hs  to be loaded actually loads 
> Foo.o.  No matter how documented it is,  it seems odd.
>
>
> On Mar 7, 2007, at 09:18 , GHC wrote:
>
>> #1205: ghci reports functions not in scope after loading a .hs, if  there is a .o
>> present
>> ----------------------------- 
>> +----------------------------------------------
>>  Reporter:  guest            |          Owner:
>>      Type:  feature request  |         Status:  new
>>  Priority:  normal           |      Milestone:  _|_
>> Component:  GHCi             |        Version:  6.6
>>  Severity:  normal           |     Resolution:
>>  Keywords:                   |     Difficulty:  Unknown
>>  Testcase:                   |   Architecture:  Unknown
>>        Os:  Unknown          |
>> ----------------------------- 
>> +----------------------------------------------
>> Changes (by simonmar):
>>
>>   * milestone:  => _|_
>>   * type:  bug => feature request
>>
>> Comment:
>>
>>  Personally I don't consider this a bug: the behaviour is clearly
>>  documented, and GHC tells you that it is loading the `.o` file in the
>>  output from `:load`.  The fact that `:load foo` is just shorthand for
>>  `:load foo.hs` is a good thing, IMO.
>>
>>  If you want to force compilation, then `:!touch foo.hs` works  fine.  Given
>>  this, the argument that we should provide special support seems  weak, to
>>  me.  You can even define a macro, e.g.
>>  {{{
>>   :def interpret (\str -> return (":!touch " ++ str ++  "\n:load " + + str))
>>  }}}
>>
>>  I'll leave this open as a feature request in case others want to  comment.
>>  If there's a concensus for a change, we can turn it into a task.
>>
>> -- 
>> Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1205>
>> GHC <http://www.haskell.org/ghc/>
>> The Glasgow Haskell  Compiler_______________________________________________
>> Glasgow-haskell-bugs mailing list
>> Glasgow-haskell-bugs at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
>
> _______________________________________________
> Glasgow-haskell-bugs mailing list
> Glasgow-haskell-bugs at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs 




More information about the Glasgow-haskell-bugs mailing list