[Haskell-cafe] Proposal: TypeDirectedNameResolution

Twan van Laarhoven twanvl at gmail.com
Thu Aug 13 18:49:20 EDT 2009

John Meacham wrote:
> On Mon, Jul 27, 2009 at 04:41:37PM -0400, John Dorsey wrote:
>>I'm assuming that name resolution is currently independent of type
>>inference, and will happen before type inference.  With the proposal this is
>>no longer true, and in general some partial type inference will have to
>>happen before conflicting unqualified names are resolved.
>>My worry is that the proposal will require a compliant compiler to
>>interweave name resolution and type inference iteratively.
> Indeed. This is my concern too. I can't see any way to do implement it
> in jhc at least without some major hassle. Name Resolution occurs
> several stages before typechecking, even before desugaring, having to
> intertwine it with type checking would be a complicated affair to say
> the least. 

You can still resolve the names first, while keeping the ambiguity:

     data Expr = ...
               | OverloadedVar [UniqueId] -- after name resolution

Then the type checker checks all possible overloads, and in the end only one 
variable reference is left.

TDNR would still complicate the typechecker, since it suddenly needs to do 


More information about the Haskell-Cafe mailing list