Hacker News new | ask | show | jobs
by mrkeen 45 days ago
"Generic" and "for a particular type" cancel out.

You don't need List<A> to write an IntList, nor do you need + to work on different integers in order to have a particular integer.

1 comments

Agreed. But there's a big difference between parametric polymorphism (List<A>) and ad-hoc polymorphism like typeclasses. It would be very painful to have to write a new list type for any kind of value type it might hold, but with monads you have many fewer distinct implementations (mainly just Maybe / Either / List / State / IO) and their actions are so different that you almost have to know exactly which monad you are using in the code, so "generic" code that can operate with any monad is less useful.