[Haskell-cafe] Proposal: TypeDirectedNameResolution
Ertugrul Söylemez
es at ertes.de
Sun Mar 3 17:18:59 CET 2013
Enrique <enriquesl at gmail.com> wrote:
> So, I think that it was not a good design decision not to use RPN as
> the basic notation for Haskell, but it is late for changing it :( .
I don't think you want that anyway. First of all, meet van Laarhoven
lenses [1]:
x ^. field . subfield
This has the order you know from OOP, so the basic syntactic support for
quick method auto-suggestion is there. You don't even need
Control.Category, because the (.) is actually the regular function
composition operator. So where to go from here?
One advantage of Haskell is that there is no such thing as a method.
It's all functions and values, and you can actually establish a measure
for how exactly a type captures another. Now just auto-suggest /all/
functions in scope sorted by how exactly their type matches. You can do
that without lenses, if you have a smart editor:
stdout `
Now it might display something like this:
stdout `[hPutStrLn ]
[hSetBuffering]
[hClose ]
[... ]
[const ]
[id ]
Finally when you select one of the functions it rewrites it to:
hPutStrLn stdout
Of course in a real editor you would also show the type signature and
probably also the module from where it was imported.
I consider the record problem solved in Haskell.
Greets,
Ertugrul
[1]: <http://hackage.haskell.org/package/lens>
--
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130303/63bfde14/attachment.pgp>
More information about the Haskell-Cafe
mailing list