Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jscomp/others/js_boolean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

(** Contains functions for dealing with JavaScript booleans *)

external to_js_boolean : bool -> Js.boolean = "%identity"
external to_js_boolean : bool -> bool = "%identity"

2 changes: 1 addition & 1 deletion jscomp/others/js_boolean.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

(** Contains functions for dealing with JavaScript booleans *)

external to_js_boolean : bool -> Js.boolean = "%identity"
external to_js_boolean : bool -> bool = "%identity"
[@@ocaml.deprecated "This function is not needed any more"]
8 changes: 4 additions & 4 deletions jscomp/others/js_json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type _ kind =
| Number : float kind
| Object : t Js_dict.t kind
| Array : t array kind
| Boolean : Js.boolean kind
| Boolean : bool kind
| Null : Js_types.null_val kind


Expand Down Expand Up @@ -94,7 +94,7 @@ let decodeArray json =

let decodeBoolean json =
if Js.typeof json = "boolean"
then Some (Obj.magic (json:t) : Js.boolean)
then Some (Obj.magic (json:t) : bool)
else None

let decodeNull json =
Expand All @@ -115,15 +115,15 @@ external stringifyAny : 'a -> string option =
external null : t = "" [@@bs.val]
external string : string -> t = "%identity"
external number : float -> t = "%identity"
external boolean : Js.boolean -> t = "%identity"
external boolean : bool -> t = "%identity"
external object_ : t Js_dict.t -> t = "%identity"

external array_ : t array -> t = "%identity"

external array : t array -> t = "%identity"
external stringArray : string array -> t = "%identity"
external numberArray : float array -> t = "%identity"
external booleanArray : Js.boolean array -> t = "%identity"
external booleanArray : bool array -> t = "%identity"
external objectArray : t Js_dict.t array -> t = "%identity"
external stringify: t -> string = "stringify"
[@@bs.val] [@@bs.scope "JSON"]
Expand Down
12 changes: 6 additions & 6 deletions jscomp/others/js_json.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type _ kind =
| Number : float kind
| Object : t Js_dict.t kind
| Array : t array kind
| Boolean : Js.boolean kind
| Boolean : bool kind
| Null : Js_types.null_val kind

type tagged_t =
Expand Down Expand Up @@ -75,7 +75,7 @@ val decodeArray : t -> t array option
(** [decodeArray json] returns [Some a] if [json] is an array, [None]
otherwise *)

val decodeBoolean : t -> Js.boolean option
val decodeBoolean : t -> bool option
(** [decodeBoolean json] returns [Some b] if [json] is a boolean, [None]
otherwise *)

Expand All @@ -98,8 +98,8 @@ external string : string -> t = "%identity"
external number : float -> t = "%identity"
(** [number n] makes a JSON number of the [float] [n] *)

external boolean : Js.boolean -> t = "%identity"
(** [boolean b] makes a JSON boolean of the [Js.boolean] [b] *)
external boolean : bool -> t = "%identity"
(** [boolean b] makes a JSON boolean of the [bool] [b] *)

external object_ : t Js_dict.t -> t = "%identity"
(** [object_ dict] makes a JSON objet of the [Js.Dict.t] [dict] *)
Expand All @@ -118,8 +118,8 @@ external stringArray : string array -> t = "%identity"
external numberArray : float array -> t = "%identity"
(** [numberArray a] makes a JSON array of the [float array] [a] *)

external booleanArray : Js.boolean array -> t = "%identity"
(** [booleanArray] makes a JSON array of the [Js.boolean array] [a] *)
external booleanArray : bool array -> t = "%identity"
(** [booleanArray] makes a JSON array of the [bool array] [a] *)

external objectArray : t Js_dict.t array -> t = "%identity"
(** [objectArray a] makes a JSON array of the [JsDict.t array] [a] *)
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/js_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type function_val
type _ t =
| Undefined : undefined_val t
| Null : null_val t
| Boolean : Js.boolean t
| Boolean : bool t
| Number : float t
| String : string t
| Function : function_val t
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/js_types.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type function_val
type _ t =
| Undefined : undefined_val t
| Null : null_val t
| Boolean : Js.boolean t
| Boolean : bool t
| Number : float t
| String : string t
| Function : function_val t
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/node.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type node_module = <

filename : string ;

loaded : Js.boolean;
loaded : bool;
children : node_module array ;
paths : string array;
> Js.t
Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/node_fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ module Watch = struct
type t
type config
external config :
?persistent:Js.boolean ->
?recursive:Js.boolean ->
?persistent: bool ->
?recursive: bool ->
?encoding: Js_string.t ->
unit -> config =
"" [@@bs.obj]
Expand Down
4 changes: 2 additions & 2 deletions jscomp/runtime/caml_basic.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

val none : 'a option
val some : 'a -> 'a option
val is_none : 'a option -> Js.boolean
val is_none : 'a option -> bool
val to_def : 'a option -> 'a Js_undefined.t
val cons : 'a -> 'a list -> 'a list
val is_list_empty : 'a list -> Js.boolean
val is_list_empty : 'a list -> bool
8 changes: 5 additions & 3 deletions jscomp/runtime/js.mli
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ external test : 'a nullable -> bool = "#is_nil_undef"
external testAny : 'a -> bool = "#is_nil_undef"

type boolean = bool
[@@ocaml.deprecated "Use type bool instead"]
(** The value could be either {!Js.true_} or {!Js.false_}.
Note in BuckleScript, [boolean] has different representation from OCaml's [bool],
see conversion functions in {!Boolean} *)
Expand All @@ -93,10 +94,10 @@ type (+'a, +'e) promise
*)


val true_ : boolean
val true_ : bool
[@@ocaml.deprecated "Use true directly"]

val false_ : boolean
val false_ : bool
[@@ocaml.deprecated "Use false directly"]

external null : 'a null = "#null"
Expand All @@ -106,7 +107,8 @@ external undefined : 'a undefined = "#undefined"
(** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*)


external to_bool : boolean -> bool = "%identity"
external to_bool : bool -> bool = "%identity"
[@@ocaml.deprecated "This function is not needed any more"]
(** convert Js boolean to OCaml bool *)

external typeof : 'a -> string = "#typeof"
Expand Down
24 changes: 12 additions & 12 deletions jscomp/runtime/js_typed_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module type S = sig

(* Accessor functions
*)
external includes : elt -> Js.boolean = "" [@@bs.send.pipe: t] (** ES2016 *)
external includes : elt -> bool = "" [@@bs.send.pipe: t] (** ES2016 *)

external indexOf : elt -> int = "" [@@bs.send.pipe: t]
external indexOfFrom : elt -> from:int -> int = "indexOf" [@@bs.send.pipe: t]
Expand Down Expand Up @@ -125,12 +125,12 @@ module type S = sig
external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t]
*)

external every : (elt -> Js.boolean [@bs]) -> Js.boolean = "" [@@bs.send.pipe: t]
external everyi : (elt -> int -> Js.boolean [@bs]) -> Js.boolean = "every" [@@bs.send.pipe: t]
external every : (elt -> bool [@bs]) -> bool = "" [@@bs.send.pipe: t]
external everyi : (elt -> int -> bool [@bs]) -> bool = "every" [@@bs.send.pipe: t]

(** should we use [bool] or [boolan] seems they are intechangeable here *)
external filter : (elt -> bool [@bs]) -> t = "" [@@bs.send.pipe: t]
external filteri : (elt -> int -> Js.boolean[@bs]) -> t = "filter" [@@bs.send.pipe: t]
external filteri : (elt -> int -> bool [@bs]) -> t = "filter" [@@bs.send.pipe: t]

external find : (elt -> bool [@bs]) -> elt Js.undefined = "" [@@bs.send.pipe: t]
external findi : (elt -> int -> bool [@bs]) -> elt Js.undefined = "find" [@@bs.send.pipe: t]
Expand All @@ -154,8 +154,8 @@ module type S = sig
external reduceRight : ('b -> elt -> 'b [@bs]) -> 'b -> 'b = "" [@@bs.send.pipe: t]
external reduceRighti : ('b -> elt -> int -> 'b [@bs]) -> 'b -> 'b = "reduceRight" [@@bs.send.pipe: t]

external some : (elt -> Js.boolean [@bs]) -> Js.boolean = "" [@@bs.send.pipe: t]
external somei : (elt -> int -> Js.boolean [@bs]) -> Js.boolean = "some" [@@bs.send.pipe: t]
external some : (elt -> bool [@bs]) -> bool = "" [@@bs.send.pipe: t]
external somei : (elt -> int -> bool [@bs]) -> bool = "some" [@@bs.send.pipe: t]

(* commented out until bs has a plan for iterators
external values : elt array_iter = "" [@@bs.send.pipe: t]
Expand Down Expand Up @@ -204,7 +204,7 @@ module TypedArray (Type: Type) : S with type elt = Type.t = struct

(* Accessor functions
*)
external includes : elt -> Js.boolean = "" [@@bs.send.pipe: t] (** ES2016 *)
external includes : elt -> bool = "" [@@bs.send.pipe: t] (** ES2016 *)

external indexOf : elt -> int = "" [@@bs.send.pipe: t]
external indexOfFrom : elt -> from:int -> int = "indexOf" [@@bs.send.pipe: t]
Expand Down Expand Up @@ -234,12 +234,12 @@ module TypedArray (Type: Type) : S with type elt = Type.t = struct
external entries : (int * elt) array_iter = "" [@@bs.send.pipe: t]
*)

external every : (elt -> Js.boolean [@bs]) -> Js.boolean = "" [@@bs.send.pipe: t]
external everyi : (elt -> int -> Js.boolean [@bs]) -> Js.boolean = "every" [@@bs.send.pipe: t]
external every : (elt -> bool [@bs]) -> bool = "" [@@bs.send.pipe: t]
external everyi : (elt -> int -> bool [@bs]) -> bool = "every" [@@bs.send.pipe: t]

(** should we use [bool] or [boolan] seems they are intechangeable here *)
external filter : (elt -> bool [@bs]) -> t = "" [@@bs.send.pipe: t]
external filteri : (elt -> int -> Js.boolean[@bs]) -> t = "filter" [@@bs.send.pipe: t]
external filteri : (elt -> int -> bool [@bs]) -> t = "filter" [@@bs.send.pipe: t]

external find : (elt -> bool [@bs]) -> elt Js.undefined = "" [@@bs.send.pipe: t]
external findi : (elt -> int -> bool [@bs]) -> elt Js.undefined = "find" [@@bs.send.pipe: t]
Expand All @@ -263,8 +263,8 @@ module TypedArray (Type: Type) : S with type elt = Type.t = struct
external reduceRight : ('b -> elt -> 'b [@bs]) -> 'b -> 'b = "" [@@bs.send.pipe: t]
external reduceRighti : ('b -> elt -> int -> 'b [@bs]) -> 'b -> 'b = "reduceRight" [@@bs.send.pipe: t]

external some : (elt -> Js.boolean [@bs]) -> Js.boolean = "" [@@bs.send.pipe: t]
external somei : (elt -> int -> Js.boolean [@bs]) -> Js.boolean = "some" [@@bs.send.pipe: t]
external some : (elt -> bool [@bs]) -> bool = "" [@@bs.send.pipe: t]
external somei : (elt -> int -> bool [@bs]) -> bool = "some" [@@bs.send.pipe: t]

(* commented out until bs has a plan for iterators
external values : elt array_iter = "" [@@bs.send.pipe: t]
Expand Down