3 ms·
Scala’s category theory faculties are so incredibly awkward without an outside library like Cats, I never thought I was writing “good code” in the functional st
by alextheparrot 9y ago
Scala’s category theory faculties are so incredibly awkward without an outside library like Cats, I never thought I was writing “good code” in the functional style in Scala until I started using Monads et al via Cats/Scalaz. Don’t get me wrong, I could compose my function A then B then C, but now I’m passing around these awkward Function1 instances that are hard to reuse and honestly just look unstructured. It feels like fighting against a tide instead of riding it to shore.
The utility also doesn’t necessarily come from the ability to transform A => B, as this is often provided by the user, but from being able to maintain the context while doing so (Mapping over a future should maintain the asynchronous context, mapping over a try should maintain the error capturing context). I understand the author appears to know much more, but I also don’t accept that they’ve contributed anything to a novice reading and attempting to improve/modify their Scala code via an improvement to their category theory knowledge.
- gclaramunt 9y agoYou're right and I struggled with the idea to add more in the first post, but I've decided to leave the more interesting stuff (Functors!) for the next part.