[Haskell-cafe] Type Directed Name Resolution

Gábor Lehel illissius at gmail.com
Thu Nov 11 09:16:30 EST 2010

On Thu, Nov 11, 2010 at 2:59 PM, Miguel Mitrofanov
<miguelimo38 at yandex.ru> wrote:
> 11.11.2010 16:53, Stephen Tetley пишет:
>> On 11 November 2010 13:10, Lauri Alanko<la at iki.fi>  wrote:
>>> {-# LANGUAGE EmptyDataDecls, MultiParamTypeClasses,
>>> FunctionalDependencies #-}
>>> data PetOwner
>>> data FurnitureOwner
>>> data Cat = Cat { catOwner :: PetOwner }
>>> data Chair = Chair { chairOwner :: FurnitureOwner }
>>> class Owned a b | a ->  b where
>>>  owner :: a ->  b
>>> instance Owned Cat PetOwner where
>>>  owner = catOwner
>>> instance Owned Chair FurnitureOwner where
>>>  owner = chairOwner
>> This is fairly onerous for people who are programming to an outside
>> schema (i.e. a relational database) as it leads to boiler plate along
>> two axes - data type definitions plus class definitions for accessors.
>> I don't like the details current TDNR proposal, but if improved
>> records are never going to happen, TDNR has benefit for this
>> situation.
> That's kinda the point, it can work the other way: ugly solution like TDNR
> can prevent improved records from ever appearing.

I tend to be mistrustful of this kind of
perfect-is-the-enemy-of-the-good thinking, it rarely ends up working
out well. Usually the result is that you end up with nothing. And
while you can't prove a counterfactual, I'm really not sure if getting
the 'good' ever actually acts to hold back the 'perfect' later. The
mechanism is intuitive enough: people decide the 'good' solution is
good enough, resulting in less demand for the better one. But to take
the present situation at least, there is plenty of demand for an
improved records system and it doesn't seem to be getting us any
closer to gaining one. Maybe implementing TDNR will make people
complacent and delay it further, maybe it'll actually make people
hungrier for further improvement, maybe it'll have no effect, who
knows? 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.

>> Incidentally there is now a member of the ML family with a
>> sophisticated record system - MLPolyR:
>> http://ttic.uchicago.edu/~wchae/wiki/pmwiki.php
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Work is punishment for failing to procrastinate effectively.

More information about the Haskell-Cafe mailing list