Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set type t for a better approach on universal code #9

Open
pedrobslisboa opened this issue May 8, 2024 · 1 comment
Open

Set type t for a better approach on universal code #9

pedrobslisboa opened this issue May 8, 2024 · 1 comment

Comments

@pedrobslisboa
Copy link

Hi there,

I was working on universalize the melange-json code on server-reason-react: ml-in-barcelona/server-reason-react#133

Reading the melange-json code led me to doubt.

Could we have type t = Js.Json.t instead of using directly the Js.Json.t inside the code?

The idea is to create a nice way to have a code that works by itself, I understand it depends on Js.Json.t internally, but every usage of Json would return its type: Json.t, and will handle on every function by its type.

The usage in the end could be:

let encodeStr str : Json.t = Json.encode str

Without conflict between Js.Json.t (Which isn't the main type of Json) and any other tool, such as Yojson.

Is it valid? WDYT?

@andreypopp
Copy link
Collaborator

Ppx_deriving_json_runtime is kinda like that, the module name isn't nice though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants