External Core in binary format

Tim Chevalier catamorphism at gmail.com
Thu Jun 28 21:53:21 EDT 2007


On 6/28/07, Simon Marlow <simonmarhaskell at gmail.com> 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



More information about the Cvs-ghc mailing list