Discussion on Ergonomics and Tree-Shaking in Effect vs. ZIO for Backend TypeScript Development
Hey all,
I've been working with Scala/ZIO for many years (since pre 1.0). Recently started a new job doing backend typescript, and I was thrilled to learn
we have a ZIO port and it's pretty awesome!
However, reading up on code examples so far I worry that the huge benefits might not be enough to convince my new team with learning how to write Effect code.
The main issue that I recognize is this ergonomics gap between ZIO and Effect:
While in ZIO it's possible to express a program with this concise, ergonomic description:
with Effect this becomes:
or alternatively:
Just to grasp the difference, if we were to reduce field names to 1 letter and do a 1 liner, here's the comparison:
This is less than half the characters required to express the same program.
I assume the reason for not adding all the functions in an Uber-Effect type is tree-shaking.
If that's the case - I would ask: is bundle size actually important in backend services?
I think reducing clutter in code is probably way more important in this context. I would also argue that with AI doing much of
the work, reducing word count in code bases saves money by reducing token counts (more costly than bundle storage).
Given all that, are we open to possibly having a separate package for Effect that sacrifices tree shaking for an Uber Effect type, ZIO style?
I've been working with Scala/ZIO for many years (since pre 1.0). Recently started a new job doing backend typescript, and I was thrilled to learn
we have a ZIO port and it's pretty awesome!
However, reading up on code examples so far I worry that the huge benefits might not be enough to convince my new team with learning how to write Effect code.
The main issue that I recognize is this ergonomics gap between ZIO and Effect:
While in ZIO it's possible to express a program with this concise, ergonomic description:
with Effect this becomes:
or alternatively:
Just to grasp the difference, if we were to reduce field names to 1 letter and do a 1 liner, here's the comparison:
This is less than half the characters required to express the same program.
I assume the reason for not adding all the functions in an Uber-Effect type is tree-shaking.
If that's the case - I would ask: is bundle size actually important in backend services?
I think reducing clutter in code is probably way more important in this context. I would also argue that with AI doing much of
the work, reducing word count in code bases saves money by reducing token counts (more costly than bundle storage).
Given all that, are we open to possibly having a separate package for Effect that sacrifices tree shaking for an Uber Effect type, ZIO style?
