Re: [Haskell-cafe] segfault when using ghc api

2011-02-28 Thread Edward Amsden
That's doing what I want, but I'm not sure why you passed [(mkModule (stringToPackageId "base") (mkModuleName "Prelude"), Nothing) ] to setContext. I found that [mkModule (stringToPackageId "base") (mkModuleName "Prelude")] matches the type expected by setContext. Perhaps we are using different a

Re: [Haskell-cafe] segfault when using ghc api

2011-02-28 Thread Daniel Schüssler
Hi, On 2011-February-27 Sunday 16:20:06 Edward Amsden wrote: > Secondly, > > I'd like to get to a GHC session that just has, say, Prelude in scope > so I can use dynCompileExpr with "show" etc, but I cannot figure out > how to bring it into scope. The closest I got was to get GHC > complaining th

Re: [Haskell-cafe] segfault when using ghc api

2011-02-27 Thread Edward Amsden
Thanks, that fixed it. Why was it segfaulting on "Nothing" though? Secondly, I'd like to get to a GHC session that just has, say, Prelude in scope so I can use dynCompileExpr with "show" etc, but I cannot figure out how to bring it into scope. The closest I got was to get GHC complaining that it

Re: [Haskell-cafe] segfault when using ghc api

2011-02-27 Thread Anthonin Bonnefoy
Hi, The first argument of runGhc takes the directory where GHC's library are. You can use the ghc-paths module (http://hackage.haskell.org/package/ghc-paths ) for this. Just install ghc-paths with cabal, import Ghc.Paths and call runGhc with (Just libdir), it should get past the segfault. On Sun

[Haskell-cafe] segfault when using ghc api

2011-02-27 Thread Edward Amsden
I'm trying to run the following code. I'm not at all sure it's correct, it's based off of a bit of poking around in the ghc api. Running it with a command line argument like "show (5 + 2)" gives me a segmentation fault. Poking around with gdb and following the steps at http://hackage.haskell.org/tr