3 ms·
> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html https://kotlinlang.org/docs/reference/sealed-classes.html Those are not type-classes,
by Filligree 9y ago
> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html https://kotlinlang.org/docs/reference/sealed-classes.html
Those are not type-classes, at least not in the Haskell sense. They allow you to avoid an else branch, yes, which is actually quite useful; but one basic ability they're missing is the ability to define a new branch for a new instance of the type defined by library users.
Just as an example. They're really not much like type-classes at all.