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.
ghc-devs mailing list