
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

Maybe you want tcRnExpr :: HscEnv -> InteractiveContext -> LHsExpr RdrName -> IO (Messages, Maybe Type) from TcRnDriver? | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@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@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (2)
-
Simon Peyton-Jones
-
Sven Urbanski