Skip to content

ghci -fobject-code strangeness

With this Foo.hs:

module Foo (b) where

a = 2
b = 3
c = 4

I get this strange behaviour:

> ghci -fobject-code
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :l foo
[1 of 1] Compiling Foo              ( foo.hs, foo.o )
Ok, modules loaded: Foo.
*Foo> :browse
b :: Integer
*Foo> a

<interactive>:1:1:
    Can't find interface-file declaration for variable a
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression: a
    In an equation for `it': it = a
*Foo> 

So a is in scope, but it can't be used. Furthermore, :browse *Foo does not show a or c (it does without -fobject-code).

Trac metadata
Trac field Value
Version 7.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information