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

tweak using abstract #2396

Merged
merged 1 commit into from Dec 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 8 additions & 14 deletions jscomp/others/bs_internalAVLtree.ml
Expand Up @@ -13,20 +13,14 @@
(** Adapted by authors of BuckleScript without using functors *)


type ('k, + 'v) node

external node :
left:('k,'v) node Js.null ->
key: 'k ->
value:'v ->
right:('k,'v) node Js.null ->
h:int -> ('k,'v) node = "" [@@bs.obj]

external left : ('k,'v) node -> ('k,'v) node Js.null = "left" [@@bs.get]
external key : ('k,'v) node -> 'k = "key" [@@bs.get]
external value : ('k,'v) node -> 'v = "value" [@@bs.get]
external right : ('k,'v) node -> ('k,'v) node Js.null = "right" [@@bs.get]
external h : _ node -> int = "h" [@@bs.get]
type ('k, + 'v) node = {
left : ('k,'v) node Js.null;
key : 'k;
value : 'v;
right : ('k,'v) node Js.null;
h : int
} [@@bs.deriving abstract]

external toOpt : 'a Js.null -> 'a option = "#null_to_opt"
external return : 'a -> 'a Js.null = "%identity"
external empty : 'a Js.null = "#null"
Expand Down