Two reasons type classes are superior to OOP-style interfaces: 1. You can define instances for 3rd party data types 2. You can use the same data but different logic Type classes decouple capabilities from both types and data, giving you increased flexibility and power.
-
-
Replying to @jdegoes
3. There’s no assumption that you are dealing with a particular “instance” of the type, nor the asymmetry of privileging such an instance (“this”) over other arguments to functions
1 reply 0 retweets 1 like -
Replying to @pelotom
Those are type classes, just encoded via interfaces. That’s not OOP, IMO, it’s an implementation detail of an FP construct.
2 replies 0 retweets 3 likes -
How are type classes not OOP? They have ad hoc polymorphism, inheritance, etc.
1 reply 0 retweets 0 likes -
You can define OOP to be whatever you want. Doesn’t make it useful or correct, however.
1 reply 0 retweets 1 like -
Too many people have defined "OOP" to mean a lot of bullshit. But if you argue against "OOP" by strawmanning it to the worst definition rather than steelmanning it to the best, then you're not actually establishing much.
2 replies 3 retweets 3 likes -
Forget OOP for a sec, let's just talk about interfaces, as seen in Java, C#, etc. Can we agree that type classes are strictly more powerful than those?
1 reply 0 retweets 0 likes
Yes, but they also use return-type polymorphism, which violates type erasure. So you don't get something for nothing.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!