4 ms·
Typeclasses. They're a huge improvement over OO-style overloading, but using them as your default way of talking about structures is a Faustian bargain: - Impl
by consilient 4y ago
Typeclasses. They're a huge improvement over OO-style overloading, but using them as your default way of talking about structures is a Faustian bargain:
- Implementing two instances of one member each is much more work than one instance with two members, which incentivizes overly coarse typeclass hierarchies: hence Num and friends, which are a disaster.
- They don't provide a good way to talk about one structure uniquely determining another (e.g. a given semigroup can be made a monoid in at most one way), which leads to boilerplate overly pessimistic constraint resolution.
- The way constraint resolution works forces them to take type constructors, not types - which makes aliases, type families, etc. second class citizens.