[Haskell-cafe] Proposal: TypeDirectedNameResolution

Cale Gibbard cgibbard at gmail.com
Mon Jul 27 12:52:38 EDT 2009

2009/7/27 Jules Bean <jules at jellybean.co.uk>:
> Cale Gibbard wrote:
>> What do people think of this idea? Personally, it really annoys me
>> whenever I'm forced to give explicit module qualifications, and I
>> think this would really help. It would also subsume the
>> DisambiguateRecordFields extension rather handily.
> A disadvantage - and this is not a "No" vote, just a remark - is that when
> trying to debug the expression:
> foo bar baz quux
> if I type ":t bar" I will presumably get an ambiguity error, and I may have
> no easy way of working out *which* bar was actually intended in this line of
> code.
> I don't know how much of a burden this is, but it feels like a burden to
> writing/debugging/understanding code.
> Jules

There certainly do seem like some cases where it would help the person
reading the code to qualify which module you meant, so clearly if it's
not very obvious which selection of modules produces the unique way to
get things to typecheck, that's not very good.

Perhaps there should at least be the restriction that there must exist
a chain of individual choices made where there was a unique
possibility at each step. This ensures that you never have to
backtrack in deciding which modules things are intended to come from.

Of course, in cases where it's still not obvious, it'd still be
possible to make the qualification explicit. The goal is to eliminate
the need to explicitly qualify in the cases where it's entirely
obvious what the qualification should be.

 - Cale

More information about the Haskell-Cafe mailing list