3 ms·
> you're effectively talking about a secondary, novel type system, right? Yes, exactly. The main reason I prefer language-level effects rather than monads is
by Rusky 9y ago
> you're effectively talking about a secondary, novel type system, right?
Yes, exactly.
The main reason I prefer language-level effects rather than monads is for composability with normal imperative control flow. Monads are written in terms of higher order functions passing closures around, and that gets really messy in a language where you not only have early return and loops with break and continue, but you also have destructors that need to run as you enter and leave scopes.
You can add that kind of stuff as monads but it gets really messy, and is basically completely untenable in a language like Rust that also cares about memory management. Even if Rust did have HKT, it would still be impossible to write a Monad trait that supports them all, for example.
This article makes some great points on the subject: http://blog.paralleluniverse.co/2015/08/07/scoped-continuations/ http://blog.paralleluniverse.co/2015/08/07/scoped-continuati...