I think the missing piece was Opt_Cpp.  Data.List uses the C preprocessor

S

| -----Original Message-----
| From: cvs-ghc-boun...@haskell.org [mailto:cvs-ghc-boun...@haskell.org] On
| Behalf Of Ian Lynagh
| Sent: 22 February 2011 15:09
| To: Jane Ren
| Cc: cvs-...@haskell.org; glasgow-haskell-users@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-...@haskell.org
| http://www.haskell.org/mailman/listinfo/cvs-ghc


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to