Question about Haskell AST

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


On Mon, Jan 10, 2011 at 9:21 AM, Jane Ren <j2ren at ucsd.edu> 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?
http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/ext-core.html
http://hackage.haskell.org/package/extcore

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

Cheers,
Tim

-- 
Tim Chevalier * http://cs.pdx.edu/~tjc/ * 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