-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2436 from BuckleScript/abstract_signature
deriving support in abstract language
- Loading branch information
Showing
32 changed files
with
382 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
type 'elt t0 = 'elt node Js.null | ||
and 'elt node = private { | ||
mutable left : 'elt t0; | ||
key : 'elt ; | ||
mutable right : 'elt t0; | ||
h : int | ||
} [@@bs.deriving abstract] | ||
(* TODO: node is used in [subset] *) | ||
external toOpt : 'a Js.null -> 'a option = "#null_to_opt" | ||
external return : 'a -> 'a Js.null = "%identity" | ||
external empty : 'a Js.null = "#null" | ||
|
||
|
||
|
||
val copy : 'a t0 -> 'a t0 | ||
val create : 'a t0 -> 'a -> 'a t0 -> 'a t0 | ||
val bal : 'a t0 -> 'a -> 'a t0 -> 'a t0 | ||
val singleton0 : 'a -> 'a t0 | ||
|
||
val min0Aux : 'a node -> 'a | ||
val minOpt0 : 'a t0 -> 'a option | ||
val minNull0 : 'a t0 -> 'a Js.null | ||
val max0Aux : 'a node -> 'a | ||
val maxOpt0 : 'a t0 -> 'a option | ||
val maxNull0 : 'a t0 -> 'a Js.null | ||
|
||
val removeMinAuxWithRef : 'a node -> 'a ref -> 'a t0 | ||
|
||
val empty0 : 'a t0 | ||
val isEmpty0 : 'a t0 -> bool | ||
val stackAllLeft : 'a t0 -> 'a node list -> 'a node list | ||
val iter0 : 'a t0 -> ('a -> 'b [@bs]) -> unit | ||
val fold0 : 'a t0 -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b | ||
val forAll0 : 'a t0 -> ('a -> bool [@bs]) -> bool | ||
val exists0 : 'a t0 -> ('a -> bool [@bs]) -> bool | ||
val join : 'a t0 -> 'a -> 'a t0 -> 'a t0 | ||
val concat : 'a t0 -> 'a t0 -> 'a t0 | ||
val filter0 : 'a t0 -> ('a -> bool [@bs]) -> 'a t0 | ||
val partition0 : | ||
'a t0 -> ('a -> bool [@bs]) -> 'a t0 * 'a t0 | ||
val lengthAux : 'a node -> int | ||
val length0 : 'a t0 -> int | ||
|
||
val toList0 : 'a t0 -> 'a list | ||
val checkInvariant : _ t0 -> bool | ||
val toArray0 : 'a t0 -> 'a array | ||
val balMutate : 'a node -> 'a node | ||
val removeMinAuxMutateWithRoot : 'a node -> 'a node -> 'a t0 | ||
val ofSortedArrayAux : 'a array -> int -> int -> 'a t0 | ||
val ofSortedArrayUnsafe0 : 'a array -> 'a t0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
|
||
type ('key, 'a) t0 = ('key, 'a) node Js.null | ||
and ('k, + 'v) node = { | ||
left : ('k,'v) t0; | ||
key : 'k; | ||
value : 'v; | ||
right : ('k,'v) t0; | ||
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" | ||
|
||
|
||
val height : _ t0 -> int | ||
|
||
val create : | ||
('a,'b) t0 -> 'a -> 'b -> ('a,'b) t0 -> ('a,'b) t0 | ||
val singleton0 : 'a -> 'b -> ('a,'b) t0 | ||
|
||
val bal : | ||
('a,'b) t0 -> 'a -> 'b -> ('a,'b) t0 -> ('a,'b) t0 | ||
|
||
val empty0 : _ t0 | ||
|
||
val isEmpty0 : _ t0 -> bool | ||
|
||
val minBinding0 : ('a,'b) t0 -> ('a * 'b) option | ||
|
||
val maxBinding0 : ('a,'b) t0 -> ('a * 'b) option | ||
val removeMinAux : ('a, 'b) node -> ('a,'b) t0 | ||
val merge : ('a,'b) t0 -> ('a,'b) t0 -> ('a,'b) t0 | ||
val iter0 : ('a -> 'b -> 'c [@bs]) -> ('a,'b) t0 -> unit | ||
val map0 : ('a -> 'b [@bs]) -> ('c, 'a) t0 -> ('c, 'b) t0 | ||
val mapi0 : | ||
('a -> 'b -> 'c [@bs]) -> ('a,'b) t0 -> ('a, 'c) t0 | ||
val fold0 : ('a -> 'b -> 'c -> 'c [@bs]) -> ('a,'b) t0 -> 'c -> 'c | ||
val forAll0 : ('a -> 'b -> bool [@bs]) -> ('a,'b) t0 -> bool | ||
val exists0 : ('a -> 'b -> bool [@bs]) -> ('a,'b) t0 -> bool | ||
|
||
val join : ('a,'b) t0 -> 'a -> 'b -> ('a,'b) t0 -> ('a, 'b) t0 | ||
|
||
val concat : ('a,'b) t0 -> ('a,'b) t0 -> ('a,'b) t0 | ||
|
||
val concat_or_join : | ||
('a,'b) t0 -> 'a -> 'b option -> ('a,'b) t0 -> ('a, 'b) t0 | ||
val filter0 : ('a -> 'b -> bool [@bs]) -> ('a,'b) t0 -> ('a,'b) t0 | ||
val partition0 : | ||
('a -> 'b -> bool [@bs]) -> | ||
('a,'b) t0 -> ('a,'b) t0 * ('a,'b) t0 | ||
|
||
val stackAllLeft : | ||
('a,'b) t0 -> ('a, 'b) node list -> ('a, 'b) node list | ||
val lengthAux : ('a, 'b) node -> int | ||
val length0 : ('a,'b) t0 -> int | ||
val bindings_aux : ('a * 'b) list -> ('a,'b) t0 -> ('a * 'b) list | ||
val bindings0 : ('a,'b) t0 -> ('a * 'b) list | ||
val checkInvariant : ('a,'b) t0 -> bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.