4 ms·
How about the languages that have already "solved" the problem (in terms of ergonomically usage), such as Haskell, Purescript, Scala and a lot of other niche la
by valenterry 5y ago
How about the languages that have already "solved" the problem (in terms of ergonomically usage), such as Haskell, Purescript, Scala and a lot of other niche languages?
That being said, Rust has a bit of a harder time due to the focus on performance and optimally zero-cost abstraction, whereas other languages are more lenient and focus rather on expressiveness and composability / code reuse.
- rrradical 5y agoWell, more attempts at this problem come along pretty often (speaking for Haskell at least, and I expect those attempts to be more mature than the other languages you mentioned), so I don't think you can say those languages have solved it. Like the other comment mentioned, it's an active area of research, and some of the research happens in languages designed to solve that problem, and some happens in languages that support solutions to the problem. (Just to add- there's a really wide range of ergonomics that you can support and it's hard to get everything right. And performance is super tricky!)
- sullyj3 5y agoI mean, monads famously don't compose - you have to write a bunch of monad transformers.
- sfvisser 5y agoTrue, but not a huge real world issue in nearly all the relevant cases. I can very easily have a fallible, asynchronous, multi-value, stateful, database connected computation that returns a Bool and use it in let’s say ‘filterM’. Most transformers are already written for me. Edit: switching between no effect and some effect is the tricky part though.
- sullyj3 5y agoI find in practice that even though I don't have to write the transformers myself, `lift`ing and `unlift`ing things is a pain in the ass. Once you try a proper algebraic effect system, it's hard to feel like transformers are an adequate solution.
- thinkharderdev 5y agoMost of the relevant plumbing is generic though. Check out ZIO or cats-effect in Scala which I think both provide highly composable effect systems.