It would be nice to have a Eio.Promise.map function.
Currently, you can implement something close with:
let map ~sw f v =
let p, r = Eio.Promise.create ~label:"map" () in
Eio.Fiber.fork ~sw (fun () ->
Eio.Promise.await v |> f |> Eio.Promise.resolve r
);
p
But that essentially requires attaching a switch to your promise, and the promise API is switchless, it would be nice to keep it that way for mapping new promises. I don't quite understand the underlying Cell API enough to know if this is possible though.
It would be nice to have a
Eio.Promise.mapfunction.Currently, you can implement something close with:
But that essentially requires attaching a switch to your promise, and the promise API is switchless, it would be nice to keep it that way for mapping new promises. I don't quite understand the underlying
CellAPI enough to know if this is possible though.