[Haskell-cafe] Fwd: GHC as a library error.

Paulo Pocinho pocinho at gmail.com
Tue Oct 18 00:34:47 CEST 2011

Forwarding to Haskell-Cafe:
I'm trying GHC as a library, as documented in:


However, this code:

import GHC
import GHC.Paths ( libdir )
import DynFlags ( defaultDynFlags )

main =
   defaultErrorHandler defaultDynFlags $ do
     runGhc (Just libdir) $ do
       dflags <- getSessionDynFlags
       setSessionDynFlags dflags
       target <- guessTarget "test_main.hs" Nothing
       setTargets [target]
       load LoadAllTargets


Couldn't match expected type `Severity'
           with actual type `DynFlags.Settings'
Expected type: DynFlags.LogAction
 Actual type: DynFlags.Settings -> DynFlags
In the first argument of `defaultErrorHandler', namely
In the expression: defaultErrorHandler defaultDynFlags

How can I fix it?

Note: this was on a fresh install with latest stable GHC installer 7.2.1.

More information about the Haskell-Cafe mailing list