From 020b58394071e87c991aa1ed2d17591d0f870359 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 17:22:17 -0600 Subject: [PATCH 1/5] better test runner --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 996dd37..ead6c1d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ build: jbuilder build @install test: - jbuilder runtest + jbuilder runtest --no-buffer clean: jbuilder clean From e699d636c315441e5dcd52e0e848ee8ef720c9d8 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 20:44:10 -0600 Subject: [PATCH 2/5] script to generate ocaml flags --- qtest/Makefile | 2 +- qtest/jbuild | 2 +- src/bigarray/jbuild | 5 ++--- src/jbuild | 13 ++++++++++--- src/mkflags.ml | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/mkflags.ml diff --git a/qtest/Makefile b/qtest/Makefile index 09e30e4..c8a9751 100644 --- a/qtest/Makefile +++ b/qtest/Makefile @@ -1,6 +1,6 @@ QTEST_PREAMBLE='' -DONTTEST=../src/sequenceLabels.ml +DONTTEST=../src/sequenceLabels.ml ../src/mkflags.ml QTESTABLE=$(filter-out $(DONTTEST), \ $(wildcard ../src/*.ml) \ $(wildcard ../src/*.mli) \ diff --git a/qtest/jbuild b/qtest/jbuild index 3b74acb..0843466 100644 --- a/qtest/jbuild +++ b/qtest/jbuild @@ -1,7 +1,7 @@ (rule ((targets (run_qtest.ml)) - (deps ((file Makefile))) + (deps ((file Makefile) )) ; (glob_files ../src/**/*.ml{,i}))) (fallback) ;(libraries (qtest qcheck)) (action diff --git a/src/bigarray/jbuild b/src/bigarray/jbuild index e59b07f..f44100a 100644 --- a/src/bigarray/jbuild +++ b/src/bigarray/jbuild @@ -5,7 +5,6 @@ (libraries (sequence bigarray)) (wrapped false) (optional) - (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -w -33 -safe-string -color always)) - (ocamlopt_flags (:standard -O3 -color always - -unbox-closures -unbox-closures-factor 20)) + (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) + (ocamlopt_flags (:standard (:include ../flambda.flags))) )) diff --git a/src/jbuild b/src/jbuild index 981b07e..c20d7d9 100644 --- a/src/jbuild +++ b/src/jbuild @@ -1,11 +1,18 @@ +(rule + ((targets (flambda.flags)) + (deps ((file mkflags.ml))) + (fallback) + (action + (run ocaml ./mkflags.ml)) + )) (library ((name sequence) (public_name sequence) (wrapped false) - (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always -nolabels)) - (ocamlopt_flags (:standard -O3 -color always - -unbox-closures -unbox-closures-factor 20)) + (modules (Sequence SequenceLabels)) + (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels)) + (ocamlopt_flags (:standard (:include flambda.flags))) (libraries (bytes result)) )) diff --git a/src/mkflags.ml b/src/mkflags.ml new file mode 100644 index 0000000..e6edba0 --- /dev/null +++ b/src/mkflags.ml @@ -0,0 +1,14 @@ + + let () = + let major, minor = + Scanf.sscanf Sys.ocaml_version "%u.%u" + (fun major minor -> major, minor) + in + let after_4_3 = (major, minor) >= (4, 3) in + let flags_file = open_out "flambda.flags" in + if after_4_3 then ( + output_string flags_file "(-O3 -unbox-closures -unbox-closures-factor 20 -color always)\n"; + ) else ( + output_string flags_file "()\n"; + ); + close_out flags_file From c6d3c3b9d85f352c63bcf4360b1b6f8e92acc543 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 16:43:55 -0600 Subject: [PATCH 3/5] update doc url --- sequence.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequence.opam b/sequence.opam index a515569..af9f888 100644 --- a/sequence.opam +++ b/sequence.opam @@ -31,6 +31,6 @@ homepage: "https://github.com/c-cube/sequence/" depopts: [ "base-bigarray" ] -doc: "http://cedeela.fr/~simon/software/sequence/Sequence.html" +doc: "https://c-cube.github.io/sequence/" bug-reports: "https://github.com/c-cube/sequence/issues" dev-repo: "https://github.com/c-cube/sequence.git" From 86ae1b0cb03dc2a06db880d8b41edd66a5e625e3 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 17:25:29 -0600 Subject: [PATCH 4/5] update travis --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c73cd77..4edcd67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,8 @@ before_install: install: # Install dependencies - opam pin add --no-action sequence . - - opam install oasis - - opam install --deps-only sequence + - opam install jbuilder base-bytes result script: - make build - opam install qcheck qtest - - ./configure --enable-tests - make test From 943cff09da47be5dad1bd41ba5a0a25b845dd6a9 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 16:36:45 -0600 Subject: [PATCH 5/5] prepare for 1.0 --- README.adoc | 4 ++-- sequence.opam | 2 +- src/Sequence.mli | 12 ++++++------ src/SequenceLabels.mli | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.adoc b/README.adoc index 60ce610..d158824 100644 --- a/README.adoc +++ b/README.adoc @@ -25,13 +25,13 @@ To get an overview of sequence, its origins and why it was created, you can start with http://cedeela.fr/~simon/talks/sequence.pdf[the slides of a talk] I (@c-cube) made at some OCaml meeting. -See https://c-cube.github.io/sequence/api/[the online API] +See https://c-cube.github.io/sequence/[the online API] for more details on the set of available functions. == Build 1. via opam `opam install sequence` -2. manually (need OCaml >= 3.12): `make all install` +2. manually (need OCaml >= 4.02.0): `make all install` If you have https://github.com/vincent-hugot/iTeML[qtest] installed, you can build and run tests with diff --git a/sequence.opam b/sequence.opam index af9f888..cb04bad 100644 --- a/sequence.opam +++ b/sequence.opam @@ -1,6 +1,6 @@ opam-version: "1.2" name: "sequence" -version: "0.11" +version: "1.0" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" license: "BSD-2-clauses" diff --git a/src/Sequence.mli b/src/Sequence.mli index b6a2fdb..bbddc5a 100644 --- a/src/Sequence.mli +++ b/src/Sequence.mli @@ -37,7 +37,7 @@ type +'a t = ('a -> unit) -> unit type +'a sequence = 'a t (** {b NOTE} Type [('a, 'b) t2 = ('a -> 'b -> unit) -> unit] - has been removed and subsumed by [('a * 'b) t] @since NEXT_RELEASE *) + has been removed and subsumed by [('a * 'b) t] @since 1.0 *) type 'a equal = 'a -> 'a -> bool type 'a hash = 'a -> int @@ -226,7 +226,7 @@ val filter_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b t val filter_count : ('a -> bool) -> 'a t -> int (** Count how many elements satisfy the given predicate - @since NEXT_RELEASE *) + @since 1.0 *) val intersperse : 'a -> 'a t -> 'a t (** Insert the single element between every element of the sequence *) @@ -234,15 +234,15 @@ val intersperse : 'a -> 'a t -> 'a t val keep_some : 'a option t -> 'a t (** [filter_some l] retains only elements of the form [Some x]. Same as [filter_map (fun x->x)] - @since NEXT_RELEASE *) + @since 1.0 *) val keep_ok : ('a, _) Result.result t -> 'a t (** [keep_ok l] retains only elements of the form [Ok x]. - @since NEXT_RELEASE *) + @since 1.0 *) val keep_error : (_, 'e) Result.result t -> 'e t (** [keep_error l] retains only elements of the form [Error x]. - @since NEXT_RELEASE *) + @since 1.0 *) (** {2 Caching} *) @@ -485,7 +485,7 @@ val rev : 'a t -> 'a t val zip_i : 'a t -> (int * 'a) t (** Zip elements of the sequence with their index in the sequence. - Changed type @since NEXT_RELEASE to just give a sequence of pairs *) + Changed type @since 1.0 to just give a sequence of pairs *) val fold2 : ('c -> 'a -> 'b -> 'c) -> 'c -> ('a * 'b) t -> 'c diff --git a/src/SequenceLabels.mli b/src/SequenceLabels.mli index 809c054..0cd7dd3 100644 --- a/src/SequenceLabels.mli +++ b/src/SequenceLabels.mli @@ -15,7 +15,7 @@ type +'a t = ('a -> unit) -> unit type +'a sequence = 'a t (** {b NOTE} Type [('a, 'b) t2 = ('a -> 'b -> unit) -> unit] - has been removed and subsumed by [('a * 'b) t] @since NEXT_RELEASE *) + has been removed and subsumed by [('a * 'b) t] @since 1.0 *) type 'a equal = 'a -> 'a -> bool type 'a hash = 'a -> int @@ -199,7 +199,7 @@ val seq_list_map : f:('a -> 'b t) -> 'a list -> 'b list t val filter_count : f:('a -> bool) -> 'a t -> int (** Count how many elements satisfy the given predicate - @since NEXT_RELEASE *) + @since 1.0 *) val intersperse : x:'a -> 'a t -> 'a t (** Insert the single element between every element of the sequence *) @@ -207,15 +207,15 @@ val intersperse : x:'a -> 'a t -> 'a t val keep_some : 'a option t -> 'a t (** [filter_some l] retains only elements of the form [Some x]. Same as [filter_map (fun x->x)] - @since NEXT_RELEASE *) + @since 1.0 *) val keep_ok : ('a, _) Result.result t -> 'a t (** [keep_ok l] retains only elements of the form [Ok x]. - @since NEXT_RELEASE *) + @since 1.0 *) val keep_error : (_, 'e) Result.result t -> 'e t (** [keep_error l] retains only elements of the form [Error x]. - @since NEXT_RELEASE *) + @since 1.0 *) (** {2 Caching} *) @@ -457,7 +457,7 @@ val rev : 'a t -> 'a t val zip_i : 'a t -> (int * 'a) t (** Zip elements of the sequence with their index in the sequence. - Changed type @since NEXT_RELEASE to just give a sequence of pairs *) + Changed type @since 1.0 to just give a sequence of pairs *) val fold2 : f:('c -> 'a -> 'b -> 'c) -> init:'c -> ('a * 'b) t -> 'c