3 ms·
I could never give up higher-kinded types: there are plenty of ad-hoc solutions to various effects, but a single reusable solution[1] means you can build up lib
by lmm 9y ago
I could never give up higher-kinded types: there are plenty of ad-hoc solutions to various effects, but a single reusable solution[1] means you can build up libraries that not only handle all the common effects, but your own custom ones as well. Even if you don't use them directly, you benefit from the ecosystem they make possible. Few other languages let you use something like treelog[2], fewer still let you fold a custom tree type while managing an effect as nicely as with matryoshka. Typeclass derivation is reflection done right, with compile-time safety and corresponding performance. I've never seen another language that made it so easy to put a database transaction boundary in exactly the right place but in a type-safe way so that you can never forget, or even have transactions implicitly applied to web endpoints that need them in a 100% statically-compile-time-checked way, because your endpoint routing is just plain old code (the way it is in akka-http[4] or rho[5]). Hell, even when it comes to something as basic as result types: Kotlin or Typescript can't do them (nicely) at all, and Rust's can't offer nice syntax without a macro (or a magic trait in newer versions of the language).
There are plenty of things wrong with Scala - in many ways I'd like to see a clean replacement - but now that I think in HKT I could never go back to a language that doesn't have them.
[1] http://philipnilsson.github.io/Badness10k/escaping-hell-with-monads/ http://philipnilsson.github.io/Badness10k/escaping-hell-with...
[2] https://github.com/lancewalton/treelog https://github.com/lancewalton/treelog
[3] https://github.com/slamdata/matryoshka https://github.com/slamdata/matryoshka
[4] https://doc.akka.io/docs/akka-http/10.0.4/scala/http/introduction.html#routing-dsl-for-http-servers https://doc.akka.io/docs/akka-http/10.0.4/scala/http/introdu...
[5] https://github.com/http4s/rho https://github.com/http4s/rho