4 ms·
I think the logic behind the name is e.g. “‘Eq t’ is the class of types ‘t’ that support equality”, with “class” having the sense of “subset”.
by evincarofautumn 9y ago
I think the logic behind the name is e.g. “‘Eq t’ is the class of types ‘t’ that support equality”, with “class” having the sense of “subset”.
- Jare 9y agoThat's exactly how I think of it: Typeclass = a class of types, which makes my C++ brain think of templates not inheritance.
- zzalpha 9y agoOh, I don't dispute the name is logical. I'm saying in the broader context of programming languages, it's confusing. And that that confusion could have been easily foreseen and avoided... after all, Smalltalk had been using the term "class" for almost 20 years before Haskell appeared and introduced their terminology.
- mbrock 9y agoHaskell uses the words "type", "class", and "kind", and maybe some others too, which are all just simple English words that denote some form of abstract grouping ("form" and "group" I suppose are two other candidates). At least they're called "typeclasses" and not just "classes". But we're always going to have some overloading of these powerful short ancient words. I did recently see a suggestion to rename the "typeclass" keyword to "algebra" which would be pretty cool!