Neil Mitchell wrote:

So presumably you'd be happy if you could do something like this:

import qualified GHC

getYHCCore :: FilePath -> YHC.Core
getYHCCore file = do
     s <- GHC.newSession
     ghc_core <- GHC.compileToCore s "Foo.hs"
     convertToYHCCore ghc_core

ie. without any on-disk representation at all, just using the GHC API. We don't currently have GHC.compileToCore, but it would be just a matter of doing the
plumbing.

Yes, that would suit my needs perfectly. The only one niggle might be
that for some applications I'll need to have compiled all the
libraries into Core as well, so the compileToCore function would
require things like "Prelude.hs" to work as well.

Well, in GHC the Prelude ~= the base package, so you'll have to translate (a large chunk of) base into YHC.Core. It uses lots of primitives, so you'll need translations for many of those (exceptions? MVars? GMP operations?). You'll need to be able to do foreign calls, too. This all sounds pretty ambitious.

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to