[Haskell-cafe] Type Directed Name Resolution

Ben Lippmeier benl at ouroborus.net
Fri Nov 12 01:40:50 EST 2010

On 12/11/2010, at 2:26 AM, Malcolm Wallace wrote:

>> The point is that refusing something you can have now (though
>> of course it's an open question whether TDNR is something we can "have
>> now") out of fear that it'll prevent you getting something better
>> later is speculative and often backfires.
> I think we are very far from having TDNR "now".  It is really quite complicated to interleave name resolution with type checking in any compiler.  So far, we have a design, that's all, no implementation.  We also have (several) designs for proper record systems.

Disciple has TDNR, and there is an implementation in DDC. It is a bit complicated, mainly because you can't determine the call graph of the program before starting inference. In ML style inference you're supposed to let-generalise groups of recursive bindings together, but for TDNR you can only determine what is recursive once you've resolved the names (which depends on the types, which you need to infer).

The algorithm is described starting at page 168 in my thesis here: http://www.cse.unsw.edu.au/~benl/papers/thesis/lippmeier-impure-world.pdf

Disciple doesn't have type functions or associated types though. I think it'd be "nicer" for GHC if we could leverage some of the other extensions, as suggested in Mark Lentczner's post.


More information about the Haskell-Cafe mailing list