Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=fe7cc6e9871ec6eb9f4db51360f0b5b0
sha512=f7bd3b4839a383959c2cb96632cc5fb9e60b7c2655aea34d535fe2b5c1af290125c895541a063f75cad0acad7d808a61535c7a5e974a4c4fb05526979f886a20
Description
Added to opam-repository:
README
Js_of_ocaml Ppx deriver
ppx_deriving_jsoo is a js_of_ocaml ppx deriver. From an ocaml type it provides the jsoo type interface and the conversion functions.
Example
The ocaml type:
type 'a x = {
a : int64 list;
b : 'a option;
c : int option; [@opt]
d : string; [@mutable]
e : char; [@key "js_key"]
f : int -> string; [@callback]
g : Unsafe.any -> int -> string; [@meth_callback]
h : unit -> int; [@meth]
i : js_string t; [@ignore]
j : (nativeint * string array);
k : [ `A | `B of float ];
} [@@deriving jsoo]Will produce the class type:
class type ['a] x_jsoo = object
method a :
Ezjs_min.bigInt Ezjs_min.t Ezjs_min.js_array Ezjs_min.t readonly_prop
method b : 'a Ezjs_min.optdef readonly_prop
method c : int Ezjs_min.opt readonly_prop
method d : Ezjs_min.js_string Ezjs_min.t prop
method js_key_ : Ezjs_min.js_string Ezjs_min.t readonly_prop
method f : (int -> Ezjs_min.js_string Ezjs_min.t) callback readonly_prop
method g :
(Ezjs_min.Unsafe.any, int -> Ezjs_min.js_string Ezjs_min.t)
meth_callback readonly_prop
method h : int Ezjs_min.meth
method i : js_string t readonly_prop
method j : 'a _j_tupjsoo Ezjs_min.t readonly_prop
method k : 'a _k_tupjsoo Ezjs_min.t readonly_prop
end
and ['a] _j_tupjsoo = object
method _0 : Ezjs_min.bigInt Ezjs_min.t Ezjs_min.readonly_prop
method _1 :
Ezjs_min.js_string Ezjs_min.t Ezjs_min.js_array Ezjs_min.t
Ezjs_min.readonly_prop
end
and ['a] _k_tupjsoo = object
method _A : unit Ezjs_min.optdef Ezjs_min.readonly_prop
method _B : Ezjs_min.number Ezjs_min.t Ezjs_min.optdef Ezjs_min.readonly_prop
endAnd the conversion functions:
val x_to_jsoo :
(('a -> 'a_jsoo) * ('a_jsoo -> 'a)) -> 'a x -> 'a_jsoo x_jsoo Ezjs_min.t)
val x_of_jsoo :
(('a -> 'a_jsoo) * ('a_jsoo -> 'a)) -> 'a_jsoo x_jsoo Ezjs_min.t -> 'a x)
val x_jsoo_conv :
(('a -> 'a_jsoo) * ('a_jsoo -> 'a)) -> 'a x -> 'a_jsoo x_jsoo Ezjs_min.t) *
(('a -> 'a_jsoo) * ('a_jsoo -> 'a)) -> 'a_jsoo x_jsoo Ezjs_min.t -> 'a x)Where Ezjs_min comes from ezjs_min library whose module includes Js_of_ocaml.Js and some other userful functions.
There is also a deriver for only interface:
[@@deriving jsoo_type]And for only conversion functions:
[@@deriving jsoo_conv]Most of regular types are handled. GADT are not handled. Also some complicated recursive types can fail the ppx since the class types impose some constraints.
Dev Dependencies
None
Optional Dependencies (1)
Conflicts (1)
-
ezjs_min
< "0.2.1"
Build status
Results of building ppx_deriving_jsoo with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.3 (this version) | good | good | good | n/a | n/a |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure