[Haskell-cafe] Not working examples in GHC API documentation
John Blackbox
blackbox.dev.ml at gmail.com
Thu Jul 18 19:58:21 CEST 2013
Hi!
Please take a look here: http://www.haskell.org/haskellwiki/GHC/As_a_library
The examples are not working. Even the simpelst one:
import GHC
import GHC.Paths ( libdir )
import DynFlags ( defaultLogAction )
main =
defaultErrorHandler defaultLogAction $ do
runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags
target <- guessTarget "test_main.hs" Nothing
setTargets [target]
load LoadAllTargets
throws:
$> ghc -package ghc Main.hs
[1 of 1] Compiling Main ( Main.hs, Main.o )
Main.hs:6:25:
Couldn't match type `DynFlags' with `[Char]'
Expected type: DynFlags.FatalMessager
Actual type: DynFlags.LogAction
In the first argument of `defaultErrorHandler', namely
`defaultLogAction'
In the expression: defaultErrorHandler defaultLogAction
In the expression:
defaultErrorHandler defaultLogAction
$ do { runGhc (Just libdir)
$ do { dflags <- getSessionDynFlags;
setSessionDynFlags dflags;
.... } }
Main.hs:7:7:
Couldn't match expected type `DynFlags.FlushOut'
with actual type `IO SuccessFlag'
In a stmt of a 'do' block:
runGhc (Just libdir)
$ do { dflags <- getSessionDynFlags;
setSessionDynFlags dflags;
target <- guessTarget "test_main.hs" Nothing;
setTargets [target];
.... }
In the second argument of `($)', namely
`do { runGhc (Just libdir)
$ do { dflags <- getSessionDynFlags;
setSessionDynFlags dflags;
.... } }'
In the expression:
defaultErrorHandler defaultLogAction
$ do { runGhc (Just libdir)
$ do { dflags <- getSessionDynFlags;
setSessionDynFlags dflags;
.... } }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130718/d5a8690b/attachment.htm>
More information about the Haskell-Cafe
mailing list