News for hackers. Stuff that matters.
Re:OCaml for the Skeptical: OCaml in a Nutshell (2006) by momentoftop on Sunday August 02, 2020 @06:00PM (#24032147)
Functors are indeed a poor substitute for typeclasses if I want ad-hoc polymorphism. If I want ad-hoc polymorphism, I want typeclasses. I find Scala's implicits to be a poor substitute (though not as poor as functors), and I'm sceptical that modular implicits are going to compare to typeclasses.

But that's not why I care about functors. I use functors to package a bunch of types and values in a way that depends on a package of other types and values, which was their purpose from the beginning. In Haskell, I often want to do just this, but I find typeclasses (and associated types etc) to be a poor substitute for functors.

For this reason, I keep an eye on backpack.

There are no comments on this comment yet.