Let me provide you with a simpler example.
module Echo = struct
type _ Effect.t += Echo : string -> unit Effect.t
let run f =
Effect.Deep.try_with f ()
{
effc =
(fun (type b) (eff : b Effect.t) ->
match eff with
| Echo string ->
Some
(fun (k : (b, unit) Effect.Deep.continuation) ->
print_endline string;
Effect.Deep.continue k ())
| _ -> None);
}
end
let main () =
Echo.run (fun () ->
Eio_main.run (fun _ ->
Eio.Fiber.both
(fun () ->
Eio.Fiber.yield ();
Effect.perform (Echo.Echo "world"))
(fun () ->
Effect.perform (Echo.Echo "hello"))));
That program crashes as well. This is what I mean about composition wrt large.