Type of a HsExpr

Sven Urbanski svenurbanski at gmail.com
Wed May 18 19:13:52 CEST 2011


Hi all,

I'm having a problem similar to Ranjit in the mail "parsing types".

However, I want to get the type of an HsExpr:

getType :: HsExpr -> Type

or something similar.

This should basically do what :t does in ghci, but for any given
HsExpr (also it should not work on Strings).


Looking at the ghc sources, I found

exprType :: CoreExpr -> Type

which is pretty close to what i need.


Another way of solving this, would be a function lik this:

hsExpr2CoreExpr :: HsExpr -> CoreExpr

Than I could combine them like:

exprType . hsExpr2CoreExpr


Any hints are very much appreciated,

Sven



More information about the Glasgow-haskell-users mailing list