[Haskell-cafe] How to get a typed (type tagged) AST from GHC's core [Was: Dynamically typing TH.Exp at runtime]

Matthijs Kooijman matthijs at stdin.nl
Mon Mar 16 04:38:02 EDT 2009

Hi Martin,

> Only to avoid misunderstandings, you only use the ghc-api to get the AST
> of a CoreModule which you translate into your own data structure (VHDL).
That's correct.

> At this point, you don't use type information, right?
I use some typing information, but that's mostly hidden away. In particular,
when creating Signals using genSignalId I annotate them with the type of the
expression the signal models. Later on, I translate this type to a VHDL type.

To get at the type of an expression, I use the CoreUtils.exprType function,
which gives you the type of any CoreExpr.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090316/a73b9fef/attachment.bin

More information about the Haskell-Cafe mailing list