[Haskell-cafe] Get expected type of expression using GHC API?

Patrick Hurst lightquake at amateurtopologist.com
Wed Jan 1 05:02:37 UTC 2014


Using the GHC API, you can get the inferred type of an `LHsExpr Id` via a
`TypecheckedModule`, as hdevtools does[1]. Is there any way to get the
expected type? This would be useful for cases where the expected type is
much more polymorphic than the inferred type (or possibly for debugging
type errors with -fdefer-type-errors, depending on what GHC does in that
case).

[1] https://github.com/bennofs/hdevtools/blob/master/src/Info.hs#L133
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131231/5ef08051/attachment.html>


More information about the Haskell-Cafe mailing list