[Haskell-cafe] I'm afraid of OverloadedLabels.

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Jul 10 00:16:02 UTC 2017

> On 10/07/2017, at 9:03 AM, Nikita Churaev <lamefun.x0r at gmail.com> wrote:
> I think that a new syntax is needed though. Here's my reasoning:
> Why do mainstream OOP languages have it so easy, while Haskell hasn't
> been able to solve the name collision problem for many, many years?

Because mainstream object-oriented programming languages do not do
(bidirectional) type inference, and the one exception I can think
of (Ada) does not have variables in its type language.

Amongst non-mainstream languages, F# might repay examination.
Suspicious examination.  I see F# code doing <module>.<function>
all the time where you might have expected its OOP magic to be
> I think one of the obstacles is that currying has encouraged most
> libraries to put any object arguments last, eg:

F# is a .Net language, which is thoroughly OO.  Yet we see
> > Set.add;;
> val it : ('a -> Set<'a> -> Set<'a>) when 'a : comparison = <fun:clo at 1>

Note: the "object" argument is second, not first.  Currying and
argument order really don't seem to be related.  Haskell type-classes
don't depend on which argument is which, after all.  Consider

class Addable f
  where Eq t => add :: t -> f t -> f t

instance Addable []
  where add x ys = if x`elem`ys then ys else x:ys

newtype Set t = Set [t]

instance (Eq x) => Addable Set
  where add x (Set ys) = Set (add x ys)

> I think this is precisely the reason why OOP languages have it easy
> while Haskell is struggling.

And the OOP languages struggle to do what Haskell does easily.

It is also worth remembering that ad hoc overloading (because that
is what we're talking about) was present in PL/I, Algol 68, and
Ada 83, without any trace of OOPiness at all.  Also while letting
the clue to resolution come from any argument (or combination of

As a native speaker of an SVO language (English) in a country where
one of the official languages is VSO (Māori), I sometimes find the
OVS structure of "mainstream OO languages" a little uncomfortable...
"Backward ran sentences until reeled the mind."

More information about the Haskell-Cafe mailing list