Question about Haskell AST
Simon Peyton-Jones
simonpj at microsoft.com
Tue Feb 22 16:24:58 CET 2011
I think the missing piece was Opt_Cpp. Data.List uses the C preprocessor
S
| -----Original Message-----
| From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On
| Behalf Of Ian Lynagh
| Sent: 22 February 2011 15:09
| To: Jane Ren
| Cc: cvs-ghc at haskell.org; glasgow-haskell-users at haskell.org
| Subject: Re: Question about Haskell AST
|
|
| Hi Jane,
|
| 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 ()
| main =
| defaultErrorHandler defaultDynFlags $ do
| runGhc (Just libdir) $ do
| dflags <- getSessionDynFlags
| let dflags' = foldl xopt_set dflags
| [Opt_Cpp, Opt_ImplicitPrelude, Opt_MagicHash]
| setSessionDynFlags dflags'
| target <- guessTarget fp Nothing
| setTargets [target]
| load LoadAllTargets
| liftIO $ putStrLn "Done"
|
| Let me know if you still have problems.
|
|
| Thanks
| Ian
|
|
| _______________________________________________
| Cvs-ghc mailing list
| Cvs-ghc at haskell.org
| http://www.haskell.org/mailman/listinfo/cvs-ghc
More information about the Glasgow-haskell-users
mailing list