Using "GHC as a library" with own functions makes runStmt return RunBreak

Mads Lindstrøm mads_lindstroem at yahoo.dk
Wed Jan 30 12:00:16 EST 2008


Hi

I am trying to use "GHC as a library". From runStmt, I want to load and run
functions from a home-grown module. Lets call my home-grown module HomeGrown.hs.

I have tried to model my application after 
http://haskell.org/sitewiki/images/1/17/Interactive-6.8.hs /
http://haskell.org/sitewiki/images/f/f9/MyPrelude.hs from
http://haskell.org/haskellwiki/GHC/As_a_library . This library loads
MyPrelude.hs and runs myPutStrLn & myGetLine + more.

However, when I try to run code from HomeGrown.hs like:

  runStmt session "HomeGrown.foo" GHC.SingleStep

runStmt keeps returning RunBreak (of type RunResult). From what I can read of
the WWW, RunBreak is related to some debugger and indicate that GHC encountered
some breakpoint. However, I did not set any break points.

Comparing Interactive-6.8 and MyPrelude.hs to my own code, the largest
difference seemed to be that Interactive-6.8 do not only use MyPrelude.hs by
calling `addTarget` and `setContext`, it also imports MyPrelude.hs as a regular
Haskell import (import MyPrelude). Thus I tried to remove this import to see
what would happen. Interactive-6.8 compiled and started just fine. However,
whenever it needed to use any functions in MyPrelude, runStmt also returned
RunBreak.

So is it only possible to load home-grown/non-standard modules when also doing a
regular import?


Greetings,

Mads Lindstrøm




More information about the Glasgow-haskell-users mailing list