[Haskell-cafe] Weird ghci behaviour?

Dan Piponi dpiponi at gmail.com
Mon Nov 12 16:28:56 EST 2007


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 <dpiponi at gmail.com> wrote:
> Ian said:
>
> > Can you please give a complete testcase for the problem you're seeing?


More information about the Haskell-Cafe mailing list