server-reason-react icon indicating copy to clipboard operation
server-reason-react copied to clipboard

Current implementation of server-reason-react depends on Lwt

Open davesnx opened this issue 10 months ago • 4 comments

After the RSC work, big dependencies are introduced in the project, which means that users of server-reason-react might need to install it regardless if they don't use it; and in the worst-case scenario it won't be compatible with their set of dependencies.

If @tjdevries wants to use it with Eio for example, he would need a new package server-reason-react-eio (?) with a new implementation.

Similarly if someone doesn't want to use yojson and want to use jsont they won't be able to.

davesnx avatar Feb 05 '25 18:02 davesnx

Based on discovering OCaml packages, I found lot packages using pattern like this:

pkg
pkg-unix
pkg-lwt
pkg-eio

# h2
h2-eio
h2-lwt
h2-lwt-unix

What do you think @davesnx?

r17x avatar Sep 25 '25 08:09 r17x

Yep, I can provide an -eio and -picos implementation, but I don't have a way to abstract the io layer yet.

Do you know how those are done?

davesnx avatar Sep 25 '25 09:09 davesnx

I only know a little about how h2 abstracts that from this interface.

https://github.com/anmonteiro/ocaml-h2/blob/master/eio/h2_eio.mli https://github.com/anmonteiro/ocaml-h2/blob/master/lwt/h2_lwt.mli

I think it similar way react server implemented here

r17x avatar Sep 25 '25 09:09 r17x

That's only one part of the story. h2 uses gluten and has as well all implementations for each https://github.com/anmonteiro/gluten/blob/ea5b353be189592ef1cbdc6dbc20d582c54858c7/lwt/gluten_lwt.ml

We would need a similar abstraction for our "fiber"

davesnx avatar Sep 25 '25 09:09 davesnx