[Haskell-cafe] Type Directed Name Resolution
ryani.spam at gmail.com
Wed Nov 10 17:01:26 EST 2010
On Wed, Nov 10, 2010 at 11:08 AM, Lauri Alanko <la at iki.fi> wrote:
> Plain ad hoc overloading might or might not be a sensible addition to
> Haskell, but please at least drop the "x .f" syntax, it's a pointless
> hack that makes the lexical status of "." even more difficult than it
> currently is. After all, one can simply define e.g. "x .$ f = f x" if
> postfix application is needed.
Do you have a better suggestion? The arguments for . & postfix application:
- Standard practice in other languages
- feels similar to qualified names
- postfix application is really useful for IDEs
- . is used for too much stuff already
- postfix application isn't really Haskelly
I personally think that the arguments in favor are pretty strong.
As you've mentioned, regular ad-hoc overloading does not make a ton of
sense in Haskell; function types are complicated enough that too much
ambiguity is introduced and inference becomes very difficult. But I
see a lot of value in locally saying 'this particular invocation
should be ad-hoc overloaded' for common functions like 'length',
'map', 'lookup', etc.
More information about the Haskell-Cafe