Question about Haskell AST

Tim Chevalier catamorphism at
Mon Feb 7 01:39:05 CET 2011

On Mon, Jan 10, 2011 at 9:21 AM, Jane Ren <j2ren at> wrote:
> 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.

Sorry for the very late reply, but have you considered using External Core?

IMO, it's less pain than linking with the GHC library unless your
application really needs to get transformed Core back into the GHC


Tim Chevalier * * Often in error, never in doubt
"an intelligent person fights for lost causes,realizing that others
are merely effects" -- E.E. Cummings

More information about the Glasgow-haskell-users mailing list