| ▲ | debugnik 4 hours ago | |
> It's functional but in place This is an abuse of this term, which refers to immutable transformations that reuse memory, as in Roc and Koka, not to hiding effects within a function. > It's the code you would write in Python with types you get from OCaml and no monads. It's also the code you could write in OCaml itself. --- Having used OCaml 5 effects, I'm convinced that the trend of globally scoped effect constructors, dynamically scoped handlers and effect-typed functions are the wrong approach. They couple too many orthogonal features. Handlers should be consumed as (records of) functions that can't leak from their scope (see 'local' in OxCaml, 'ref struct' in C#) and are passed down as a capability. Now you're using two more general mechanisms to express your effects, and other forms of dynamic scoping or dynamic dispatch can be made orthogonal to effects themselves. | ||