Re: Using GHC API to compile Haskell file

2015-09-15 Thread Edward Z. Yang
Excerpts from Neil Mitchell's message of 2015-09-14 14:07:14 -0700: > >> 1) Is there any way to do the two compilations sharing some cached > >> state, e.g. loaded packages/.hi files, so each compilation goes > >> faster. > > > > You can, using withTempSession in the GhcMonad. The external

Re: Using GHC API to compile Haskell file

2015-09-14 Thread Neil Mitchell
>> 1) Is there any way to do the two compilations sharing some cached >> state, e.g. loaded packages/.hi files, so each compilation goes >> faster. > > You can, using withTempSession in the GhcMonad. The external package > state will be preserved across calls here, but things put in the HPT >

Re: Using GHC API to compile Haskell file

2015-09-07 Thread Edward Z. Yang
Hello Neil, It looks like my second message got eaten. Let's try again. > 1) Is there any way to do the two compilations sharing some cached > state, e.g. loaded packages/.hi files, so each compilation goes > faster. You can, using withTempSession in the GhcMonad. The external package state

Re: Using GHC API to compile Haskell file

2015-09-04 Thread Neil Mitchell
> Sorry about the delay; I hadn't gotten around to seeing if I could reproduce > it. Here is a working copy of the program which appears to work with GHC > 7.10.2 on 64-bit Windows: Thanks, that does indeed solve it the first bit. To try and make it a bit clearer what I'm after, I've put the

Re: Using GHC API to compile Haskell file

2015-09-03 Thread Edward Z Yang
Hello Neil, Sorry about the delay; I hadn't gotten around to seeing if I could reproduce it. Here is a working copy of the program which appears to work with GHC 7.10.2 on 64-bit Windows: module Main where import GHC import GHC.Paths ( libdir ) import DynFlags import SysTools main = do

Re: Using GHC API to compile Haskell file

2015-08-24 Thread Neil Mitchell
Thanks Edward, that fixed the issue with GHC 7.8.3. While trying to replicate with 7.10.2 to submit a bug report, I got a different error, even with your fix included: C:\Users\NDMIT_~1\AppData\Local\Temp\ghc2428_1\ghc_4.o:ghc_3.c:(.text+0x55): undefined reference to `ZCMain_main_closure' Doing

Using GHC API to compile Haskell file

2015-08-23 Thread Neil Mitchell
Hi, Is this the right place for GHC API queries? If not, is there anywhere better? I want to compile a Haskell module, much like `ghc --make` or `ghc -c` does. The sample code on the Haskell wiki (https://wiki.haskell.org/GHC/As_a_library#A_Simple_Example), StackOverflow