Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree with that. Foldable and Traversable are complete marvels of usability.


I literally, just this morning, found myself writing some annoying repeated glue-code, and realized I could shorten it up where it mattered by taking the glue and turning it into a type-class.

IMHO, people brag about type-classes too much with respect to the particular type-classes that embody category-theoretic constructions, and not enough about their original application to ad-hoc polymorphic overloading. If I can think of a Task X which I have to do for a variety of somewhat different types in somewhat different ways, but which is used in a polymorphic way, then I can absolutely make a type-class out of that.

It's like how people think the big secret to object-oriented programming is inheritance, but actual OOP experts tell you to prefer interfaces (which are almost-but-not-quite just like type-classes!) and abstain from building large inheritance hierarchies.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: