[Haskell-cafe] GHC-API: a few questions

Andrea Rossato mailing_list at istitutocolli.org
Sun Sep 2 12:22:15 EDT 2007


On Sun, Sep 02, 2007 at 04:09:11PM +0200, Andrea Rossato wrote:
> Hi,
> 
> I'm trying to acquire some confidence with the GHC-API and I'm having
> some problems, related to error handling, I seem not be able to solve.

It's always like this: you finally give up, ask for help in the
haskell-cafe, go for a walk with your dog and then the glimpse. Now
you know what you were doing wrong.

In my case I did some confusion when reading the documentation: I
thought that newSession was using the dynamic flag set with
defaultErrorHandler. That is to say, I thought I should control the
log_action with defaultErrorHandler, instead you must:
  ses <- newSession Interactive (Just ghcPath)
  df <- getSessionDynFlags ses
  setSessionDynFlags ses df {log_action = myLog } -- set here your stuff!!
  ...

The wiki was reporting this correctly, but I was misguided when
reading this blog entry:
http://austin.youareinferior.net/?q=node/29
which, nonetheless, is very helpful (the post is not incorrect by
itself. It was me who misunderstood it).

Sorry for the noise.

BTW, play with the GHC-API is a *great* fun.

Thanks for your kind attention.
Andrea



More information about the Haskell-Cafe mailing list