The title of the paper that introduced type classes is "How to make ad-hoc polymorphism less ad hoc".

It seems the type classes approach is being compared to how OOP does ad-hoc polymorphism.

As far as I can tell, the paper never explains how type classes are less ad hoc than OOP techniques like V-tables or prototype chains, or even has any comparison at all of the trade-offs between the two approaches.

What is non-ad-hoc about ad-hoc polymorphism via type classes?

Note: this is a somewhat objective question, as "ad-hoc" is here a technical term. From the paper, "Ad-hoc polymorphism occurs when a function is defined over several different types, acting in a different way for each type."

  • $\begingroup$ Notice that actual title of the paper ends with “ad hoc” without the hyphen. It should be read as “How to make ad-hoc polymorphism more generic”. $\endgroup$ – Dmitri Urbanowicz Aug 11 '20 at 10:30
  • $\begingroup$ Thanks! What's the difference between "ad-hoc" and "ad hoc"? $\endgroup$ – Max Heiber Aug 11 '20 at 10:39
  • 1
    $\begingroup$ Former is part of a technical term as you said, latter is a phrase in Latin. $\endgroup$ – Dmitri Urbanowicz Aug 11 '20 at 11:07
  • $\begingroup$ I've updated the hyphenation to reflect this distinction $\endgroup$ – Max Heiber Aug 11 '20 at 11:14
  • $\begingroup$ I do not understand what is being asked. Did you read the paper? If so, do you have a specific question or can you tell us what was unclear about it? $\endgroup$ – Andrej Bauer Aug 23 '20 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.