Re:OCaml 5.0 Alpha Release
by octachron on Wednesday June 15, 2022 @07:30AM
(#31751489)
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) 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.
[ Parent
| on HN ]
I would also recommend reading the effect handlers tutorial in OCaml 5.0 manual: https://kcsrk.info/webman/manual/effects.html.
Re:OCaml 5.0 Alpha Release
by momentoftop on Wednesday June 15, 2022 @12:44PM
(#31755649)
Is 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?
The 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.