Tim
Thank you for doing this! Could you add the example to the Wiki, to help others
find their way in?
http://haskell.org/haskellwiki/GHC/As_a_library
Simon
| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Chevalier
| Sent: 29 June 2007 02:53
| To: Simon Marlow
| Cc: [email protected]
| Subject: Re: External Core in binary format
|
| On 6/28/07, Simon Marlow <[EMAIL PROTECTED]> wrote:
| > The right sequence would be
| >
| > (a) setTarget to the desired filename
| > (b) depanal
| > (c) find the module name by searching in the ModGraph
| > (d) checkModule
| >
| > and checkModule should optionally return the Core too.
| >
| > Unfortunately, checkModule currently also does a depanal (it shouldn't, I'll
| > remove it). Also checkModule doesn't return the Core (it should).
| >
|
| I've made these changes and checked in the code. This simplifies the
| procedure for calling compileToCore even further:
| ----------
| ghcBaseDir = -- whatever
| coreFileName = -- whatever
|
| main = defaultErrorHandler defaultDynFlags $ do
| -- Set up flags...
| s <- newSession (Just ghcBaseDir)
| flags1 <- getSessionDynFlags s
| (flags2, _) <- parseDynamicFlags flags1 ["-cpp"]
| setSessionDynFlags s flags2
| -- Compile to Core
| ghc_core <- compileToCore s coreFileName
| case ghc_core of
| Just cb -> pprTrace "Core binds: " (ppr cb)
| return ()
| _ -> putStrLn "error compiling to Core"
| ----------
|
| The call to setTarget is eliminated (compileToCore does that now.)
|
| Cheers,
| Tim
|
| --
| Tim Chevalier* catamorphism.org *Often in error, never in doubt
| "The certainty of failure is sometimes a reason to try." -- Lawrence Lessig
|
| _______________________________________________
| Cvs-ghc mailing list
| [email protected]
| http://www.haskell.org/mailman/listinfo/cvs-ghc
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc