types from ghc - got them!

Axel Simon simona@I2.Informatik.RWTH-Aachen.DE
Tue, 21 Nov 2000 16:31:50 +0100 (CET)


On Tue, 21 Nov 2000, Bernard James POPE wrote:
> Obviously there are issues
> with type variables which are quantified outside the local definition, but
> careful naming of things should be able to fix this.

Hi,

For my master thesis I wrote a tool called Typeview (presented at IFL'00)
that can display the types of arbitrary expressions (even in programs that
are not typecorrect). We chose to append an underscore to every type
variable that is not quantified at the examined expression:

f :: a -> (a, Int)
f x = let g y = (x,y) in g 3

In this program the type of the local expression is g:: b -> (_a,b). This
approach could be used for local type annotations (and thereby replacing
the pattern annotations), the :t command and error messages. Of course
you have to make sure that _a is not ambiguous.

Cheers,
Axel.