Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-11 Thread AlanKim Zimmerman
Thanks for the reference, but GHC already invokes the CPP. I think I am going to have to invoke a load of the module with ghc flags set to keep the output of the CPP phase, and then re-invoke it on that output to get the tokens. My question is more whether this CPP output can be kept in the GHC

Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Carter Schonwald
you need to run a preprocessor on it to remove the directives On Tue, Sep 10, 2013 at 4:03 PM, AlanKim Zimmerman alan.z...@gmail.comwrote: Hi Cafe I have just discovered that GHC.getTokenStream fails if it is used on a module with CPP directives in it. This is reported in

Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Henk-Jan van Tuyl
On Tue, 10 Sep 2013 22:03:16 +0200, AlanKim Zimmerman alan.z...@gmail.com wrote: Is there an easy way to get access to the pre-processed source, without having to explicitly write it to an output file in a temporary location? You can run cpp with function readProcess, as done in function

Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Henk-Jan van Tuyl
On Wed, 11 Sep 2013 00:54:07 +0200, Henk-Jan van Tuyl hjgt...@chello.nl wrote: Another option could be the cpphs package; the documentation has disappeared from haskell.org, but can be found in the Web Archive[0]. I just found the latest documentation at http://code.haskell.org/cpphs/docs/

Re: [Haskell-cafe] GHC API question

2011-08-30 Thread Christiaan Baaij
Hi, This is what I've was referring to in my previous mail. Even though you're compiling to machine code, you are using the in-memory linker (i.e., the GHCi linker). It seems like that this is a fundamental limitation of the internal linker. You may be using it in a way that doesn't trigger

Re: [Haskell-cafe] GHC API question

2011-08-29 Thread Albert Y. C. Lai
On 11-08-28 11:38 AM, Chris Smith wrote: Okay, I should have waited until morning to post this... so actually, things still work fine when I build without profiling. However, when I build with profiling, I get the segfault. I'm guessing either I need to set different dynamic flags with the

Re: [Haskell-cafe] GHC API question

2011-08-29 Thread Thomas Schilling
OK, I guess I misunderstood you. I don't know how SafeHaskell works, so I don't know whether there might be some interaction. I know that profiling is a static flag which must be set when you initialise the session and cannot be changed afterwards. I assume you are doing that. I checked the

Re: [Haskell-cafe] GHC API question

2011-08-28 Thread Chris Smith
Okay, I should have waited until morning to post this... so actually, things still work fine when I build without profiling. However, when I build with profiling, I get the segfault. I'm guessing either I need to set different dynamic flags with the profiling build to match the options of the

Re: [Haskell-cafe] GHC API question

2011-08-28 Thread Thomas Schilling
I don't think you can link GHCi with binaries compiled in profiling mode. You'll have to build an executable. On 28 August 2011 16:38, Chris Smith cdsm...@gmail.com wrote: Okay, I should have waited until morning to post this... so actually, things still work fine when I build without

Re: [Haskell-cafe] GHC API question

2011-08-28 Thread Chris Smith
On Sun, 2011-08-28 at 17:47 +0100, Thomas Schilling wrote: I don't think you can link GHCi with binaries compiled in profiling mode. You'll have to build an executable. Okay... sorry to be obtuse, but what exactly does this mean? I'm not using GHCi at all: I *am* in an executable built with