diff --git a/_tags b/_tags index 45a0bee..5715982 100644 --- a/_tags +++ b/_tags @@ -28,4 +28,3 @@ : use_sequence # OASIS_STOP true: bin_annot -true: safe_string diff --git a/bigarray/sequenceBigarray.mli b/bigarray/sequenceBigarray.mli index f7de183..a9c7880 100644 --- a/bigarray/sequenceBigarray.mli +++ b/bigarray/sequenceBigarray.mli @@ -25,7 +25,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (** {1 Interface and Helpers for bigarrays} -@since NEXT_RELEASE *) +@since 0.5.4 *) val of_bigarray : ('a, _, _) Bigarray.Array1.t -> 'a Sequence.t (** Iterate on the elements of a 1-D array *) diff --git a/sequence.ml b/sequence.ml index e6d3ca5..531a90d 100644 --- a/sequence.ml +++ b/sequence.ml @@ -770,7 +770,7 @@ module IO = struct close_in_noerr ic; raise e - let write_to ?(mode=0o644) ?(flags=[Open_creat;Open_wronly]) filename seq = + let write_bytes_to ?(mode=0o644) ?(flags=[Open_creat;Open_wronly]) filename seq = let oc = open_out_gen flags mode filename in try seq (fun s -> output oc s 0 (Bytes.length s)); @@ -779,13 +779,13 @@ module IO = struct close_out oc; raise e - let write_str_to ?mode ?flags filename seq = - write_to ?mode ?flags filename (map Bytes.unsafe_of_string seq) + let write_to ?mode ?flags filename seq = + write_bytes_to ?mode ?flags filename (map Bytes.unsafe_of_string seq) + + let write_bytes_lines ?mode ?flags filename seq = + let ret = Bytes.unsafe_of_string "\n" in + write_bytes_to ?mode ?flags filename (snoc (intersperse ret seq) ret) let write_lines ?mode ?flags filename seq = - let ret = Bytes.unsafe_of_string "\n" in - write_to ?mode ?flags filename (snoc (intersperse ret seq) ret) - - let write_str_lines ?mode ?flags filename seq = - write_lines ?mode ?flags filename (map Bytes.unsafe_of_string seq) + write_bytes_lines ?mode ?flags filename (map Bytes.unsafe_of_string seq) end diff --git a/sequence.mli b/sequence.mli index 7664060..677f79c 100644 --- a/sequence.mli +++ b/sequence.mli @@ -586,19 +586,21 @@ module IO : sig different iterations might return different results *) val write_to : ?mode:int -> ?flags:open_flag list -> - string -> Bytes.t t -> unit + string -> string t -> unit (** [write_to filename seq] writes all strings from [seq] into the given file. It takes care of opening and closing the file. @param mode default [0o644] @param flags used by [open_out_gen]. Default: [[Open_creat;Open_wronly]]. *) - val write_str_to : ?mode:int -> ?flags:open_flag list -> - string -> string t -> unit + val write_bytes_to : ?mode:int -> ?flags:open_flag list -> + string -> Bytes.t t -> unit + (** @since 0.5.4 *) val write_lines : ?mode:int -> ?flags:open_flag list -> - string -> Bytes.t t -> unit + string -> string t -> unit (** Same as {!write_to}, but intercales ['\n'] between each string *) - val write_str_lines : ?mode:int -> ?flags:open_flag list -> - string -> string t -> unit + val write_bytes_lines : ?mode:int -> ?flags:open_flag list -> + string -> Bytes.t t -> unit + (** @since 0.5.4 *) end