Question about Haskell AST
igloo at earth.li
Tue Feb 22 16:09:18 CET 2011
On Mon, Feb 21, 2011 at 11:46:16PM -0800, Jane Ren wrote:
> Did you mean I have to include the dflags like below to get the parsetree of a base library file like libraries/base/GHC/List.lhs
> I am stilling getting the same error
> AstWalker: panic! (the 'impossible' happened)
> (GHC version 7.0.1 for x86_64-apple-darwin):
> lexical error at character 'i'
> my code is "...
> setSessionDynFlags ...
> target <- guessTarget targetFile Nothing
> setTargets [target]
> load LoadAllTargets"
> Would you have any other suggestions?
This works for me with the 7.0 branch:
main :: IO ()
defaultErrorHandler defaultDynFlags $ do
runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
let dflags' = foldl xopt_set dflags
[Opt_Cpp, Opt_ImplicitPrelude, Opt_MagicHash]
target <- guessTarget fp Nothing
liftIO $ putStrLn "Done"
Let me know if you still have problems.
More information about the Glasgow-haskell-users