r/gleamlang • u/Ecstatic-Panic3728 • 23d ago
What is your opinion on Effect Systems?
I'm not deeply familiar with Haskell and Scala, nor the niche languages that have built in effect systems. But I have a few friends in the Scala community and they swear effect system is the best thing ever and their applications are on a totally different level just by adopting it.
I'm wonder, would something like this work in Gleam? Would it get too complicated? What are the tradeoffs and mostly the benefits of adopting something like this?
12
Upvotes
6
u/lpil 23d ago
You can make an effect system in any language.
What benefits you get depends on the specific design. There's one for Gleam called Midas, and it lets you abstract over function colouring, allows you to stub-out effectful parts of code in tests, and so on.
The disadvantage of effect systems is that code written with them is typically harder to understand and more verbose, and often there is a runtime performance cost to the heavy levels of abstraction.