Records in Haskell
Ryan Newton
rrnewton at gmail.com
Fri Sep 16 17:31:25 CEST 2011
>> 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!
Because of the additional ambiguity? Shouldn't the IDE show all options even if the type checker requires a unique one?
> 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).
I'm not sure if I'm saying the same thing as you, here, Ian, but my take is that it be nice for an IDE to solve this in a more general way that works for normal function application as well as "x.f" "backwards" function application.
That is, the equivalent of the OOP IDE auto-complete should be to ask "what set of functions apply to this value". The problem is just that the keystrokes order is awkward. Most people typing "f x" probably type 'f' first ;-). But it should be possible to do:
" x" left-arrow left-arrow magic-keystroke
To get the same set of functions as if you do ("x." magic-keystroke), shouldn't it? (Maybe magic-keystroke inserts an implicit "undefined", type checks, and then figures out the set of functions.)
I started playing around with Leksah and scion/emacs (searching for "what's the type of this expr" support) and was a little disappointed that this functionality doesn't seem to exist yet. Or am I wrong and it exists somewhere?
Cheers,
-Ryan
More information about the Glasgow-haskell-users
mailing list