ml-in-barcelona / server-reason-react

Server render Reason React components with OCaml natively
https://ml-in-barcelona.github.io/server-reason-react/local/server-reason-react/index.html
MIT License
127 stars 8 forks source link

Any way to ensure interfaces remain valid from reason-react? #43

Open davesnx opened 11 months ago

davesnx commented 11 months ago

If we have a way to ensure our React.ml (and Belt.ml, Js.ml, etc) match with the interface we would avoid those breakages https://github.com/ml-in-barcelona/server-reason-react/pull/41 and be compatible would be a matter of following the interface.

Is there any way to depend on an interface from a dependency?

PS: Asked for help here https://discuss.ocaml.org/t/is-there-any-way-to-depend-on-an-interface-file-from-a-dependency/13077

davesnx commented 10 months ago

This was one approach https://github.com/ml-in-barcelona/server-reason-react/pull/82 but still don't have a clear solution here.

Maybe splitting what's React public library and what's ppx_runtime_lib might help, but still can face issues while users might want to use React.jsx (or other runtime_lib stuff)

davesnx commented 10 months ago

cc @jchavarri

davesnx commented 1 month ago

To check inclusion module M : module type of T = T2 and equality module M : module type of T2 = T.

When you don't want to keep type equalities module type of struct include T end

Extracted from https://www.reddit.com/r/ocaml/comments/448xdl/ocamlsafestringbuffer_a_buffer_implementation/

Unsure if there's a way now to have both libs on the same scope (melange/native)