No primitives for concurrency till Ocaml5.
Can think of effect handlers as 'first-class, restartable exceptions'
(* When [E] is performed, we will get a value of type [string] *)
string
effect E:
(* A computation. Like a thunk *)
let comp () =
print_string "0: start";
print_string (perform E);
print_string "3: end";
let main () =
try
comp ()(* Effect handler. [k] is a delimited continuation *)
with effect E k ->
print_string "1: EH start";
"2: EH cont";
continue k print_string "4: EH end";
Here control goes like: