this post was submitted on 10 Jun 2023
10 points (100.0% liked)
Scala
340 readers
1 users here now
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Sharing from my personal experience โ with the Typelevel libraries, you don't really need monad transformers if you don't like them.
For dependency injection, personally, while being a big fan and contributor of Typelevel, I prefer to use Scala as an OOP language, too, as OOP is already great for dependency injection. And I'm always surprised by the lengths people go to avoid passing parameters to constructors or to functions. Although I will say that the use of Resource for managing the lifecycle of resources is a Scala super-power.
For errors, there are different approaches, no one size fits all, but personally, I never use
EitherT
orOptionT
, and that's a false choice being presented by these 2 communities. You don't have to pick betweenEitherT
orZIO
because you can choose neither.Domain / input errors have to be designed with care, and you usually don't need short-circuiting for those. And as an alternative, what you can do instead is to design errors out of existence. I'm sharing some design advice for that here: https://alexn.org/blog/2022/04/18/scala-oop-design-sample/