Question about Haskell AST

Simon Peyton-Jones simonpj at microsoft.com
Tue Jan 11 09:06:19 CET 2011


desugarModule returns a GHC.DesugaredModule
Inside a DesugaredModule is a field dm_core_module :: HscTypes.ModGuts
Inside a ModGuts is a field mg_binds :: [CoreSyn.CoreBind]

And there are your bindings!  Does that tell you what you wanted to know?

Simon

PS: When you have it clear, would you like to augment the Wiki http://haskell.org/haskellwiki/GHC/As_a_library to describe what you learned?  That way others can benefit.

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-
| users-bounces at haskell.org] On Behalf Of Jane Ren
| Sent: 10 January 2011 17:21
| To: glasgow-haskell-users at haskell.org
| Subject: Question about Haskell AST
| 
| Hi,
| 
| I need to be able to take a piece of Haskell source code and get an
| simplified, typed, intermediate representation of the AST, which means I need
| to use compiler/coreSyn/CoreSyn.lhs
| 
| So I'm first trying to get the desguaredModule of the source code with
|         ...
|         modSum <- getModSummary $ mkModuleName "..."
|         p <- parseModule modSum
|         t <- typecheckModule p
|         d <- desugarModule t
| 
| Now I'm really stuck on figuring out how to connect the variable d of type
| desugaredModule to compiler/coreSyn/CoreSyn.lhs to get Expr patterns like
| App, Let, Case, etc.
| 
| Also, is it correct to get the deguaredModule first?  At least CoreSyn.lhs
| seems to suggest this.
| 
| Any suggestions would be greatly apprecia
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users




More information about the Glasgow-haskell-users mailing list