Fwd: Type checking expressions

Peter Podlovics peter.d.podlovics at gmail.com
Fri Mar 2 12:04:54 UTC 2018

Hello everyone,

I would like to ask for some advice regarding the type checker part of GHC.
My goal is to determine the type of every expression, pattern etc. in the
syntax tree. Currently the compiler doesn't store this information, so I
to type check manually. One important aspect is that the program may be
but I still want to extract as much information as possible.

I tried using local type checking functions (eg.: tcInferSigma), but
I used it on an expression that had some "out-of-scope" names in it, it

> f xs = length xs

The reason was that xs was not in the local environment.

My question is: how could I provide the necessary local environment for
type checking functions? Also in the general case, is it possible to somehow
annotate each expression with its type during the type checking?

The motivation for this is that I want to implement a tool that
corrects ill-typed programs based heuristics. For that I need to know the
of certain AST nodes.

Peter Podlovics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180302/53756c62/attachment.html>

More information about the ghc-devs mailing list