Records in Haskell

Ian Lynagh igloo at earth.li
Fri Sep 16 13:10:31 CEST 2011


On Fri, Sep 16, 2011 at 06:46:35AM +0100, Ganesh Sittampalam wrote:
> On 15/09/2011 15:43, Ian Lynagh wrote:
> > On Thu, Sep 15, 2011 at 08:47:30AM +0000, Simon Peyton-Jones wrote:
> >>
> > Re TypeDirectedNameResolution, I would actually prefer it if it were
> > less general. i.e. if you were to write
> >     x.f
> > then f would be required to be a record selector.
> > 
> > Then there's no need for the "If there is exactly one f whose type
> > matches that of x" unpleasantness.
> 
> One benefit of TDNR is to replicate the discoverability of APIs that OO
> programming has - if x :: Foo then typing "x." in an IDE gives you a
> list of things you can do with a Foo. (Obviously it's not a complete lis
> for various reasons, but it does allow the author of Foo and others to
> design discoverable APIs.)

But add another import, and some of those APIs disappear!

And of course, the language doesn't need to support TDNR in order for an
IDE to use it (although the juxtaposition application syntax doesn't
make the UI easy).


Thanks
Ian




More information about the Glasgow-haskell-users mailing list