4 ms·
The effect system is here, and it can already be used. However, the integration within the (surface) language and its type system is still a work in progress.
by octachron 4y ago
The effect system is here, and it can already be used. However, the integration within the (surface) language and its type system is still a work in progress.
Thus to explore the use of effects, you need to use the experimental Effect (https://github.com/ocaml/ocaml/blob/trunk/stdlib/effect.mli https://github.com/ocaml/ocaml/blob/trunk/stdlib/effect.mli) module which gives you access to low-level primitives for defining effects, installing an effect handler and resuming a continuation. The module will be considered as experimental in OCaml 5.0 and subsequent version of OCaml 5 will refine the integration within the language. The objective here was to decouple the multicore runtime work from the higher-level language design questions.
- kcsrk 4y agoI would also recommend reading the effect handlers tutorial in OCaml 5.0 manual: https://kcsrk.info/webman/manual/effects.html https://kcsrk.info/webman/manual/effects.html.
- momentoftop 4y agoIs there any plan to have effect types like in koka, where the effects that a function performs are visible in the type, and handling an effect eliminates it from the function's type?
- octachron 4y agoThe medium-term plan is indeed to have such a typed effect system. This one of the reason why the effect system is still considered to be experimental: we expect to see some breaking changes once effects become typed.