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

Add support for OCaml 5.1 #1117

Merged
merged 1 commit into from
Aug 16, 2023
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
6 changes: 6 additions & 0 deletions src/batArray.mli
Original file line number Diff line number Diff line change
Expand Up @@ -928,4 +928,10 @@ external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set"
##V>=4.6## = "%floatarray_unsafe_set"
##V>=4.6##end

##V>=5.1##val find_index : ('a -> bool) -> 'a array -> int option
##V>=5.1##val find_map : ('a -> 'b option) -> 'a array -> 'b option
##V>=5.1##val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option
##V>=5.1##val map_inplace : ('a -> 'a) -> 'a array -> unit
##V>=5.1##val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit

(**/**)
2 changes: 2 additions & 0 deletions src/batChar.mli
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ val compare: t -> t -> int
val equal : t -> t -> bool
val hash : t -> int

##V>=5.1##val seeded_hash : int -> t -> int

val ord : char BatOrd.ord

module Incubator : sig
Expand Down
3 changes: 3 additions & 0 deletions src/batInt32.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,6 @@ let min (x: t) (y: t): t =

let max (x: t) (y: t): t =
if x >= y then x else y

##V>=5.1##let seeded_hash = Int32.seeded_hash
##V>=5.1##let hash = Int32.hash
3 changes: 3 additions & 0 deletions src/batInt32.mli
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,6 @@ val print: 'a BatInnerIO.output -> t -> unit

val print_hex: 'a BatInnerIO.output -> t -> unit
(** prints as hex string *)

##V>=5.1##val seeded_hash : int -> t -> int
##V>=5.1##val hash : t -> int
3 changes: 3 additions & 0 deletions src/batInt64.ml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ let min (x: t) (y: t): t =

let max (x: t) (y: t): t =
if x >= y then x else y

##V>=5.1##let seeded_hash = Int64.seeded_hash
##V>=5.1##let hash = Int64.hash
3 changes: 3 additions & 0 deletions src/batInt64.mli
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,6 @@ val print: 'a BatInnerIO.output -> t -> unit

val print_hex: 'a BatInnerIO.output -> t -> unit
(** prints as hex string *)

##V>=5.1##val seeded_hash : int -> t -> int
##V>=5.1##val hash : t -> int
2 changes: 2 additions & 0 deletions src/batList.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ let rev_map2 = List.rev_map2
##V>=4.10##let concat_map = List.concat_map
##V>=4.10##let find_map_opt = List.find_map
##V>=4.12##let equal = List.equal
##V>=5.1##let find_index = List.find_index
##V>=5.1##let find_mapi = List.find_mapi

(* ::VH:: END GLUE *)

Expand Down
3 changes: 3 additions & 0 deletions src/batList.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1169,3 +1169,6 @@ end

val ( @ ) : 'a list -> 'a list -> 'a list
(** Tail recursive [List.append]. *)

##V>=5.1##val find_index : ('a -> bool) -> 'a list -> int option
##V>=5.1##val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option
10 changes: 10 additions & 0 deletions src/batMap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,9 @@ sig
val to_seq_from : key -> 'a t -> (key * 'a) BatSeq.t
val add_seq : (key * 'a) BatSeq.t -> 'a t -> 'a t
val of_seq : (key * 'a) BatSeq.t -> 'a t
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val add_to_list: key -> 'a -> 'a list t -> 'a list t

(** {7 Printing}*)

Expand Down Expand Up @@ -1164,6 +1167,13 @@ struct
let to_rev_seq m = Concrete.to_rev_seq (impl_of_t m)
let to_seq_from k m = Concrete.to_seq_from Ord.compare k (impl_of_t m)

let add_to_list x data m =
let add = function None -> Some [data] | Some l -> Some (data :: l) in
update_stdlib x add m

let to_list = bindings
let of_list bs = List.fold_left (fun m (k, v) -> add k v m) empty bs

module Exceptionless =
struct
let find k t = try Some (find k t) with Not_found -> None
Expand Down
4 changes: 4 additions & 0 deletions src/batMap.mli
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ sig

@since 3.3.0 *)

val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val add_to_list: key -> 'a -> 'a list t -> 'a list t

(** {6 Boilerplate code}*)

(** {7 Printing}*)
Expand Down
3 changes: 3 additions & 0 deletions src/batMarshal.mli
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type extern_flags = Marshal.extern_flags =
No_sharing (** Don't preserve sharing *)
| Closures (** Send function closures *)
##V>=4.1## | Compat_32 (** Ensure 32-bit compatibility *)
##V>=5.1## | Compression (** Compress the output if possible *)
(** The flags to the [Marshal.to_*] functions below. *)


Expand Down Expand Up @@ -100,6 +101,8 @@ val output: _ BatInnerIO.output -> ?sharing:bool -> ?closures:bool -> 'a -> unit
@since 2.3.0
*)

##V>=5.1##val compression_supported : unit -> bool

external to_string :
'a -> extern_flags list -> string = "caml_output_value_to_string"
(** Same as [to_bytes] but return the result as a string instead of
Expand Down
3 changes: 3 additions & 0 deletions src/batNativeint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ external format : string -> nativeint -> string = "caml_nativeint_format"
##V>=4.08##let unsigned_rem = Nativeint.unsigned_rem
##V>=4.08##let unsigned_div = Nativeint.unsigned_div

##V>=5.1##let seeded_hash = Nativeint.seeded_hash
##V>=5.1##let hash = Nativeint.hash

type bounded = t
let min_num, max_num = min_int, max_int

Expand Down
3 changes: 3 additions & 0 deletions src/batNativeint.mli
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ val max: t -> t -> t
##V>=4.08##
##V>=4.08## @since 2.10.0 and OCaml 4.08.0 *)

##V>=5.1##val seeded_hash : int -> t -> int
##V>=5.1##val hash : t -> int

val equal : t -> t -> bool
(** Equality function for 64-bit integers, useful for {!HashedType}. *)

Expand Down
2 changes: 1 addition & 1 deletion src/batRandom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct
let enum_bool state () = BatEnum.from (fun () -> bool state)
let enum_char state () = BatEnum.from (fun () -> char state)

##V>=5## external next: t -> (int64[@unboxed])
##V>=5## external next: t -> (int64[@unboxed])
##V>=5## = "caml_lxm_next" "caml_lxm_next_unboxed" [@@noalloc]

end
Expand Down
3 changes: 3 additions & 0 deletions src/batRandom.mli
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ module State : sig
##V>=5## correlation. Both PRNGs can be split later, arbitrarily many times.
##V>=5## @since 3.6.0 and OCaml 5.0.0 *)

##V>=5.1##val to_binary_string : t -> string
##V>=5.1##val of_binary_string : string -> t

end


Expand Down
2 changes: 2 additions & 0 deletions src/batSeq.ml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ let of_string ?(first="[") ?(last="]") ?(sep=";") of_str s =
##V>=4.14##let to_dispenser = Stdlib.Seq.to_dispenser
##V>=4.14##let ints = Stdlib.Seq.ints
##V>=4.14##let equal_stdlib = Stdlib.Seq.equal
##V>=5.1##let find_index = Stdlib.Seq.find_index
##V>=5.1##let find_mapi = Stdlib.Seq.find_mapi

module Infix = struct
(** Infix operators matching those provided by {!BatEnum.Infix} *)
Expand Down
3 changes: 3 additions & 0 deletions src/batSeq.mli
Original file line number Diff line number Diff line change
Expand Up @@ -886,3 +886,6 @@ end
##V>=4.14##
##V>=4.14## @since 4.14 *)
##V>=4.14##

##V>=5.1##val find_index : ('a -> bool) -> 'a t -> int option
##V>=5.1##val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option
3 changes: 3 additions & 0 deletions src/batSplay.ml
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ struct

let to_list m = List.of_enum (enum m)
let of_list l = of_enum (List.enum l)
let add_to_list x data m =
let add = function None -> Some [data] | Some l -> Some (data :: l) in
update_stdlib x add m

let custom_print ~first ~last ~sep kvpr out m =
Enum.print ~first ~last ~sep
Expand Down
2 changes: 2 additions & 0 deletions src/batSys.mli
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ val max_array_length : int
##V>=4.3## as the contents of the [OCAMLRUNPARAM] environment variable.
##V>=4.3## @since 2.5.0 and OCaml 4.03.0 *)

##V>=5.1##external is_regular_file : string -> bool = "caml_sys_is_regular_file"

(** {6 Signal handling} *)


Expand Down
Loading