3 ms·
> If you really think about it, type-classes are all about passing around a global vtable implicitly. If anything, Scala's implicits are a superset of Haskell's
by Flow 14y ago
> If you really think about it, type-classes are all about passing around a global vtable implicitly. If anything, Scala's implicits are a superset of Haskell's type-classes and allows for techniques that Haskell isn't capable of.
First, I'm not a Haskell expert, but from what I understand there are no vtable passed around nor attached to "objects" in Haskell.
Type-classes are used to find an implementation given an instance. Without extensions you cannot do this:
> lst :: Show a => [a]
> lst = [1, "hello"]
So Haskell isn't the slightest dynamic here.
- lanelio 14y ago"there are no vtable passed around nor attached to "objects" in Haskell" Err... what the fuck? That's exactly how they work. http://www.haskell.org/haskellwiki/OOP_vs_type_classes#Type_classes_is_a_sort_of_templates.2C_not_classes http://www.haskell.org/haskellwiki/OOP_vs_type_classes#Type_... Read about the 'dictionary' passed around. If you don't know how Haskell is implemented, why post a comment about how Haskell is implemented?