GHC API initialisation

"Philip K. F. Hölzenspies" pkfh at st-andrews.ac.uk
Tue Jun 5 12:36:49 CEST 2012


Dear GHC-ers,

Is there a reason why GHC panics with


ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.1 for x86_64-apple-darwin):
	no package state yet: call GHC.setSessionDynFlags


when I call functions that are not in a GhcMonad (viz. newHscEnv, parser, etc.)? I feel a bit silly that most of my code starts with:


defaultErrorHandler defaultLogAction (runGhc (Just libdir) $ getSessionDynFlags >>= setSessionDynFlags)


Was this a design choice? Would it be wise/nice to have a function "initialise" in the API that does precisely this?

Regards,
Philip





More information about the Cvs-ghc mailing list