typelevel / governance

Typelevel governance
Creative Commons Attribution 4.0 International
8 stars 1 forks source link

Blog post: Why Type Classes? #61

Open jducoeur opened 1 year ago

jducoeur commented 1 year ago

Hypothetical blog post that might be quite helpful, for anyone who wants to pick it up.

Lay out the argument for why type classes are a helpful way to do things. Ideally, this should not waste much time getting into the nitty-gritty of what a type class is, just link to the details (where?). Instead, focus on why type classes are a good business decision -- how they help promote better, more maintainable designs via cleaner abstractions. Provide examples of various sorts of type classes from various TL libraries. Make the case that they are fine from an efficiency POV, and not nearly as complicated as some people make it sound -- they're just a different kind of interface.

In particular, emphasize the way that the type class approach promotes better flexibility down the road, and resists too much lock-in: by stating exactly your requirements, it allows you to use whatever components fit those requirements. Possibly say in as many words that a type class based approach to the IO level allows you to be flexible even about the main engine driving the applications, and thus resists lock-in. Be clear that this is why, while cats-effect has a world-class IO engine, we tend to think of the type classes as the most important part, so that the users have this long-term flexibility.