[Haskell-cafe] Type Directed Name Resolution

Lauri Alanko la at iki.fi
Thu Nov 11 07:24:46 EST 2010


On Thu, Nov 11, 2010 at 07:04:16PM +1030, John Lask wrote:
> >>>it is often desirable to have the same field names
> >>>for many records in the same module.

> very much so, this is currently possible, with the restriction that
> the field names must have the same type modulo the record it is
> selecting on.
> 
> what is disirable is that this restriction be lifted.

Why on earth? I thought that the motivation for this feature was
simply to deal with naming conflicts with _unrelated_ records from
_unrelated_ modules without having to resort to qualified names. But I
can't see why someone would use the same accessor name for unrelated
records in a single module. And if the records are related (and the
field is conceptually "the same" for the records), then you can use a
type class to overload the accessor name in a controlled fashion.

So why would you ever need to reuse the same field name in the same
module?


Lauri


More information about the Haskell-Cafe mailing list