diff --git a/src/core/CCArray.ml b/src/core/CCArray.ml index 947d243c..a97bc62d 100644 --- a/src/core/CCArray.ml +++ b/src/core/CCArray.ml @@ -18,7 +18,7 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Arrays} *) -include Array +include CCShimsArray_ type 'a t = 'a array @@ -148,14 +148,14 @@ let sorted cmp a = b (*$= & ~cmp:(=) ~printer:Q.Print.(array int) - [||] (sorted Pervasives.compare [||]) - [|0;1;2;3;4|] (sorted Pervasives.compare [|3;2;1;4;0|]) + [||] (sorted Stdlib.compare [||]) + [|0;1;2;3;4|] (sorted Stdlib.compare [|3;2;1;4;0|]) *) (*$Q Q.(array int) (fun a -> \ let b = Array.copy a in \ - Array.sort Pervasives.compare b; b = sorted Pervasives.compare a) + Array.sort Stdlib.compare b; b = sorted Stdlib.compare a) *) let sort_indices cmp a = @@ -165,8 +165,8 @@ let sort_indices cmp a = b (*$= & ~cmp:(=) ~printer:Q.Print.(array int) - [||] (sort_indices Pervasives.compare [||]) - [|4;2;1;0;3|] (sort_indices Pervasives.compare [|"d";"c";"b";"e";"a"|]) + [||] (sort_indices Stdlib.compare [||]) + [|4;2;1;0;3|] (sort_indices Stdlib.compare [|"d";"c";"b";"e";"a"|]) *) (*$Q @@ -179,8 +179,8 @@ let sort_ranking cmp a = sort_indices compare (sort_indices cmp a) (*$= & ~cmp:(=) ~printer:Q.Print.(array int) - [||] (sort_ranking Pervasives.compare [||]) - [|3;2;1;4;0|] (sort_ranking Pervasives.compare [|"d";"c";"b";"e";"a"|]) + [||] (sort_ranking Stdlib.compare [||]) + [|3;2;1;4;0|] (sort_ranking Stdlib.compare [|"d";"c";"b";"e";"a"|]) *) (*$Q @@ -670,9 +670,11 @@ let sort_generic (type arr)(type elt) (*$inject module IA = struct + let get = Array.get + let set = Array.set + let length = Array.length type elt = int type t = int array - include Array end let gen_arr = Q.Gen.(array_size (1--100) small_int) diff --git a/src/core/CCArray.mli b/src/core/CCArray.mli index b5ddb05d..8fdd4d5e 100644 --- a/src/core/CCArray.mli +++ b/src/core/CCArray.mli @@ -18,7 +18,7 @@ type 'a printer = Format.formatter -> 'a -> unit external make_float : int -> float array = "caml_make_float_vect" (* compat *) (**/**) -include module type of Array +include module type of CCShimsArray_ type 'a t = 'a array (** The type for arrays *) diff --git a/src/core/dune b/src/core/dune index 828b2edb..4ed1429d 100644 --- a/src/core/dune +++ b/src/core/dune @@ -30,7 +30,7 @@ (libraries dune.configurator)) (rule - (targets CCShims_.ml CCShimsList_.ml CCShimsFormat_.ml) + (targets CCShims_.ml CCShimsList_.ml CCShimsArray_.ml CCShimsFormat_.ml) (deps ./mkshims.exe) (action (run ./mkshims.exe))) diff --git a/src/core/mkshims.ml b/src/core/mkshims.ml index 724910f9..3d73328b 100644 --- a/src/core/mkshims.ml +++ b/src/core/mkshims.ml @@ -41,6 +41,12 @@ let shims_list_pre_408 = " " let shims_list_post_408 = "include List" +let shims_array_pre_408 = " + include Array + type 'a t = 'a array +" +let shims_array_post_408 = "include Array" + let write_file f s = let out = open_out f in output_string out s; flush out; close_out out @@ -51,5 +57,6 @@ let () = let major, minor = Scanf.sscanf version "%u.%u" (fun maj min -> maj, min) in write_file "CCShims_.ml" (if (major, minor) >= (4,8) then shims_post_408 else shims_pre_408); write_file "CCShimsList_.ml" (if (major, minor) >= (4,8) then shims_list_post_408 else shims_list_pre_408); + write_file "CCShimsArray_.ml" (if (major, minor) >= (4,8) then shims_array_post_408 else shims_array_pre_408); write_file "CCShimsFormat_.ml" (if (major, minor) >= (4,8) then shims_fmt_post_408 else shims_fmt_pre_408); )