3 ms·
> Long story short, this library solves the function colouring problem For a great example of this, see OCaml 5 support for effect handlers. It's basically a g
by grumpyprole 4y ago
> Long story short, this library solves the function colouring problem
For a great example of this, see OCaml 5 support for effect handlers. It's basically a generalisation of exceptions, very lightweight and elegant. I can't help but think this approach would have been a much better fit for Rust than the current async effort. Monads like Async and Result are a slippery slope into the world of FP, something Rust will never excel at. Effect handlers are an alternative which arguably better align with systems programming.
- elcritch 4y agoI've heard this a lot about generic effect systems. Do you have any good resources on OCaml5 effect handlers I can follow? I dabble in type theory but prefer more pragmatic aspects. I sorta get the OCaml 5 examples I've read but don't know how it works into a generic effect system. For example, Nim has an effect system (of sorts) and I've been curious what the leap to "generalisation of exceptions" would look like for a systems language. It does feel to me like error's and async's both should remain orthogonal to most functions but we haven't had a good theory for it. What are the missing pieces and what have the OCaml5 folks been up to?!
- grumpyprole 4y ago> Do you have any good resources on OCaml5 effect handlers I can follow? I encourage you to have a look at the published paper, it's an easy read and covers the motivation and examples: https://arxiv.org/abs/2104.00250 https://arxiv.org/abs/2104.00250 Here's an excellent talk that walks through modifying a non-trivial code base for concurrency using effect handlers: https://youtu.be/k3oQwpyXmpo https://youtu.be/k3oQwpyXmpo > It does feel to me like error's and async's both should remain orthogonal They aren't completely orthogonal though, as both are effects. Haskell and Rust model both with Monads. OCaml 5 can model both with effect handlers. It is desirable to track the difference in types, this is something I hope the OCaml folks will add in the future.
- mbo 4y ago> For a great example of this, see OCaml 5 support for effect handlers. It's basically a generalisation of exceptions, very lightweight and elegant. A similar approach is being explored for Scala 3: - https://dotty.epfl.ch/docs/reference/experimental/canthrow.html https://dotty.epfl.ch/docs/reference/experimental/canthrow.h... - https://infoscience.epfl.ch/record/290885 https://infoscience.epfl.ch/record/290885 - https://github.com/lampepfl/monadic-reflection https://github.com/lampepfl/monadic-reflection (https://youtu.be/UmO-f0qTRSU https://youtu.be/UmO-f0qTRSU)
- thoradam 4y agoSee also https://www.unison-lang.org https://www.unison-lang.org