External Core - my goal
catamorphism at gmail.com
Thu Dec 27 09:39:48 EST 2007
On 12/26/07, Neil Mitchell <ndmitchell at gmail.com> wrote:
> Hi Tim,
> Since you've now checked in External Core, I thought I'd ask how close
> we are to my ideal use case of External Core. My goal is to use
> External Core with Catch (http://www-users.cs.york.ac.uk/~ndm/catch/).
> To be able to use GHC Core with Catch, it is necessary to be able to
> do one of two things:
> 1) Compile all the associate libraries and modules of a program to
> generate separate GHC Core files for each one. Link them together to
> make one GHC Core file. Convert this Core file to Yhc Core.
> 2) Compile all the associate libraries and modules to generate
> separate GHC Core files for each. Convert each Core file to Yhc Core.
> Link the Yhc Core files together.
Now that I've read this more carefully -- I think plan (2) is your
best bet. In theory, you should be able to do (2) now, using the HEAD.
In practice, I'm sure there are bugs in the API code that I just added
(and I haven't tested multiple-module programs), so you should try it
out and holler (I'll also try to do some more comprehensive testing;
we'll see who gets to it first). So it might be realistic for you to
use this for your thesis -- I'd suggest you try it soon and make some
kind of decision after a couple of iterations of bug-finding.
(1) has the problem that you would have to implement a demodulizer for
Core -- I don't think this would be all that hard, but there would be
some of the same issues that exist for demodulizing Haskell, and it
would take time. Of course, a Haskell demodulizer, HAllinOne, already
exists, so that could be used as a guide.
> I have no need to put the resultant Core back through GHC.
> How easy is it to compile up the Core for various associate libraries?
> Writing a convertor from GHC Core to Yhc Core is trivial, provided
> there can be some in-memory representation of GHC Core as an algebraic
> data type. The Core linker is trivial. The GHC bits are what I will
> need advice on!
Compiling the Core for the libraries should be easy enough. The way
I've been doing it for my purposes is by creating a list of all the
library Haskell source filenames, and running them through
compileToCore (because GHC's automatic dependency-finding won't take
care of this for me for package modules.) The main tricky bit for me
has been dealing with GHC primitives. There are a lot of them. I don't
know whether Catch needs to know what the semantics of the primitives
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
"Would you be my clock if I promise not to hang you / Too close to the
window or the picture of the pope? / I won't set you back and I won't
push you forward / I just want to look in your face and see hope" --
More information about the Glasgow-haskell-users