Type of a HsExpr

Simon Peyton-Jones simonpj at microsoft.com
Thu May 19 09:17:03 CEST 2011


Maybe you want

tcRnExpr :: HscEnv
	 -> InteractiveContext
	 -> LHsExpr RdrName
	 -> IO (Messages, Maybe Type)

from TcRnDriver?



| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Sven Urbanski
| Sent: 18 May 2011 18:14
| To: ghc-users
| Subject: Type of a HsExpr
| 
| 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
| 
| _______________________________________________
| 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