<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hello everyone,<br><br>I would like to ask for some advice regarding the type checker part of GHC.<br>My goal is to determine the type of every expression, pattern etc. in the<br>syntax tree. Currently the compiler doesn't store this information, so I have<br>to type check manually. One important aspect is that the program may be ill-typed,<br>but I still want to extract as much information as possible.<br><br>I tried using local type checking functions (eg.: tcInferSigma), but whenever<br>I used it on an expression that had some "out-of-scope" names in it, it failed.<br><br>> f xs = length xs<br><br>The reason was that xs was not in the local environment.<br><br>My question is: how could I provide the necessary local environment for these<br>type checking functions? Also in the general case, is it possible to somehow<br>annotate each expression with its type during the type checking?<br><br>The motivation for this is that I want to implement a tool that automatically<br>corrects ill-typed programs based heuristics. For that I need to know the types<br>of certain AST nodes.<span class="HOEnZb"><font color="#888888"><br><br>Peter Podlovics<br><br></font></span></div>
</div><br></div>