3 ms·
> Haskell's typeclasses kind-of do that. You're over-hedging. As your example shows, Haskell's typeclasses exactly do that.
by dllthomas 10y ago
> Haskell's typeclasses kind-of do that.
You're over-hedging. As your example shows, Haskell's typeclasses exactly do that.
- masklinn 10y agoI'm mostly hedging on the "overloading" part as Haskell doesn't support arbitrary ad-hoc polymorphism in the sense of C++/Java/C# (IIRC the foundational paper on typeclasses is about making ad-hoc polymorphism less ad-hoc). Depending how far into the overloading field nradov is, typeclasses may not match their definition of or requirements for overloading. It's probably more noticeable in Rust than in Haskell.
- dllthomas 10y agoAh, that makes sense. I don't think there's a reasonable way to define "overloading" that excludes typeclasses, but it's true that there are things that can properly be termed "overloading" which typeclasses can't (or shouldn't) do.