Steve Horne <sh006d3...@blueyonder.co.uk> wrote:

> There's a proposal at the moment to add support for TDNR to Haskell -
> to leverage "the power of the dot" (e.g. for intellisense).
>
> http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution

I'm not sure whether this should really be a language feature.  A smart
editor together with compiler support can do this without language
extensions.

The basic problem is that without the dot style you write the function
before you write its argument.  For an intellisense-like feature you
need to write the argument before you write the function.

Now in a smart editor you could write "x.", at which point the editor
could examine the source file to find the actual type of 'x' as well as
the expected type of the spot where you are currently writing.  Once it
has built a list of suitable functions, it could rewrite the "x." to
"x", place the cursor in front of it and let you browse the list of
suggestions:

       x._
    -> [suggestions]_ x

An even smarter editor could provide something like agda-mode's hole
feature.  In Agda you can write "f ?", at which point agda-mode replaces
the question mark by a hole.  You can then ask for the type of the term
that goes into the hole as well as try to infer the value.  Agda-mode
doesn't provide you with a list of suggestions, but in Haskell with type
inference this could certainly be possible.  I would prefer holes over
dot-application.


Greets,
Ertugrul

-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to