fix *Labels.mli for ocaml <= 4.04

This commit is contained in:
Fardale 2020-03-05 23:46:48 +01:00 committed by Simon Cruanes
parent c59147f1d1
commit 93be8b2cd8
3 changed files with 39 additions and 0 deletions

View file

@ -224,6 +224,13 @@ val fold2 : f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a t -> 'b t -> 'acc
@raise Invalid_argument if [a] and [b] have distinct lengths.
@since 0.20 *)
val iter2 : f:('a -> 'b -> unit) -> 'a t -> 'b t -> unit
(** [iter2 ~f a b] iterates on the two arrays [a] and [b] stepwise.
It is equivalent to [~f a0 b0; ...; ~f a.(length a - 1) b.(length b - 1); ()].
@raise Invalid_argument if [a] and [b] have distinct lengths.
@since 0.20 *)
val shuffle : 'a t -> unit
(** [shuffle a] randomly shuffles the array [a], in place. *)
@ -283,6 +290,15 @@ val map : f:('a -> 'b) -> 'a t -> 'b t
and builds an array with the results returned by [~f]:
[[| ~f a.(0); ~f a.(1); ...; ~f a.(length a - 1) |]]. *)
val map2 : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
(** [map2 ~f a b] applies function [~f] to all elements of [a] and [b],
and builds an array with the results returned by [~f]:
[[| ~f a.(0) b.(0); ...; ~f a.(length a - 1) b.(length b - 1)|]].
@raise Invalid_argument if [a] and [b] have distinct lengths.
@since 0.20 *)
val rev : 'a t -> 'a t
(** [rev a] copies the array [a] and reverses it in place.
@since 0.20 *)

View file

@ -35,6 +35,10 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t
(** Infix version of [map] with reversed arguments.
@since 0.5 *)
val cons : 'a -> 'a t -> 'a t
(** [cons x l] is [x::l].
@since 0.12 *)
val append : 'a t -> 'a t -> 'a t
(** Safe version of {!List.append}.
Concatenate two lists. *)

View file

@ -79,6 +79,9 @@ end
include module type of struct include StringLabels end
val equal : string -> string -> bool
(** Equality function on strings. *)
val compare : string -> string -> int
val is_empty : string -> bool
@ -314,6 +317,22 @@ val exists2 : f:(char -> char -> bool) -> string -> string -> bool
Those functions are deprecated in {!String} since 4.03, so we provide
a stable alias for them even in older versions. *)
val capitalize_ascii : string -> string
(** See {!String}.
@since 0.18 *)
val uncapitalize_ascii : string -> string
(** See {!String}.
@since 0.18 *)
val uppercase_ascii : string -> string
(** See {!String}.
@since 0.18 *)
val lowercase_ascii : string -> string
(** See {!String}.
@since 0.18 *)
val equal_caseless : string -> string -> bool
(** Comparison without respect to {b ascii} lowercase.
@since 1.2 *)