Ms. Molly Stewart-Gallus
Ms. Molly Stewart-Gallus

Reputation: 1168

How can I stop Hint, a Haskell runtime interpreter library, crashing the GHC interpreter?

How can I stop Hint, a Haskell runtime interpreter library, from crashing the GHC interpreter? It gives "Bus Error", "Illegal Instruction" or "Segmentation Fault" when I try to load a module using it into the GHC interpreter. This a major problem and not just an annoyance because it also crashes my application when I use hint to load code that itself uses hint. I suspect this is related to the large amount of libraries Hint drags in when linking.

I am using Mac OS 10.6.8, GHC version 7.0.4

Upvotes: 0

Views: 493

Answers (2)

Ms. Molly Stewart-Gallus
Ms. Molly Stewart-Gallus

Reputation: 1168

I solved this problem by explicitly passing the function to all code loaded.

For example, instead of doing

module Go where
import Run

go :: IO ()
go = do
  blah blah ....
  runFile etc ...

I did

module Go where

go :: RunFile -> IO ()
go runFile = do
  blah blah ....
  run runFile etc ...

Upvotes: -2

Carl
Carl

Reputation: 27003

Unfortunately, you can't stop that. The ghc api, used by both ghci and hint, cannot handle some concurrent use cases, mostly those involving loading packages and modules into the current context. There's too much global state in the ghc api.

Upvotes: 3

Related Questions