2024-05-10 22:02.41: New job: test c-cube/iter https://github.com/c-cube/iter.git#refs/heads/main (fc69ce4c919cdd04fb5041410fd61d5a3f742702) (linux-x86_64:debian-12-4.14_x86_32_opam-2.1)
Base: ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924
Opam project build
To reproduce locally:
git clone --recursive "https://github.com/c-cube/iter.git" -b "main" && cd "iter" && git reset --hard fc69ce4c
cat > Dockerfile <<'END-OF-DOCKERFILE'
FROM ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924
# debian-12-4.14_x86_32_opam-2.1
USER 1000:1000
SHELL [ "/usr/bin/linux32", "/bin/sh", "-c" ]
ENV CLICOLOR_FORCE="1"
ENV OPAMCOLOR="always"
WORKDIR /src
RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam
RUN opam init --reinit -ni
RUN uname -rs && opam exec -- ocaml -version && opam --version
WORKDIR /src
RUN sudo chown opam /src
RUN cd ~/opam-repository && (git cat-file -e 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b || git fetch origin master) && git reset -q --hard 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b && git log --no-decorate -n1 --oneline && opam update -u
COPY --chown=1000:1000 iter.opam ./
RUN opam pin add -yn iter.dev './'
ENV DEPS="astring.0.8.5 base-bigarray.base base-threads.base base-unix.base camlp-streams.5.0.1 cmdliner.1.2.0 cppo.1.6.9 csexp.1.5.2 dune.3.15.2 fmt.0.9.0 logs.0.7.0 mdx.2.4.1 ocaml.4.14.2 ocaml-base-compiler.4.14.2 ocaml-config.2 ocaml-options-vanilla.1 ocaml-version.3.6.7 ocamlbuild.0.14.3 ocamlfind.1.9.6 ounit2.2.2.7 qcheck-core.0.21.3 re.1.11.0 result.1.5 seq.base stdlib-shims.0.3.0 topkg.1.0.7"
ENV CI="true"
ENV OCAMLCI="true"
RUN opam update --depexts && opam install --cli=2.1 --depext-only -y iter.dev $DEPS
RUN opam install $DEPS
COPY --chown=1000:1000 . /src
RUN opam exec -- dune build @install @check @runtest && rm -rf _build
END-OF-DOCKERFILE
docker build .
END-REPRO-BLOCK
2024-05-10 22:02.41: Using cache hint "c-cube/iter-ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924-debian-12-4.14_x86_32_opam-2.1-e177363f9472cf745196c7ebe1714f41"
2024-05-10 22:02.41: Using OBuilder spec:
((from ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924)
(comment debian-12-4.14_x86_32_opam-2.1)
(user (uid 1000) (gid 1000))
(shell /usr/bin/linux32 /bin/sh -c)
(env CLICOLOR_FORCE 1)
(env OPAMCOLOR always)
(workdir /src)
(run (shell "sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam"))
(run (shell "opam init --reinit -ni"))
(run (shell "uname -rs && opam exec -- ocaml -version && opam --version"))
(workdir /src)
(run (shell "sudo chown opam /src"))
(run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "cd ~/opam-repository && (git cat-file -e 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b || git fetch origin master) && git reset -q --hard 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b && git log --no-decorate -n1 --oneline && opam update -u"))
(copy (src iter.opam) (dst ./))
(run (network host)
(shell "opam pin add -yn iter.dev './'"))
(env DEPS "astring.0.8.5 base-bigarray.base base-threads.base base-unix.base camlp-streams.5.0.1 cmdliner.1.2.0 cppo.1.6.9 csexp.1.5.2 dune.3.15.2 fmt.0.9.0 logs.0.7.0 mdx.2.4.1 ocaml.4.14.2 ocaml-base-compiler.4.14.2 ocaml-config.2 ocaml-options-vanilla.1 ocaml-version.3.6.7 ocamlbuild.0.14.3 ocamlfind.1.9.6 ounit2.2.2.7 qcheck-core.0.21.3 re.1.11.0 result.1.5 seq.base stdlib-shims.0.3.0 topkg.1.0.7")
(env CI true)
(env OCAMLCI true)
(run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "opam update --depexts && opam install --cli=2.1 --depext-only -y iter.dev $DEPS"))
(run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "opam install $DEPS"))
(copy (src .) (dst /src))
(run (shell "opam exec -- dune build @install @check @runtest && rm -rf _build"))
)
2024-05-10 22:02.41: Waiting for resource in pool OCluster
2024-05-11 11:22.48: Waiting for worker…
2024-05-11 11:27.55: Got resource from pool OCluster
Building on x86-bm-c18.sw.ocaml.org
All commits already cached
HEAD is now at fc69ce4 faster doc build
(from ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924)
Unable to find image 'ocaml/opam:debian-12-ocaml-4.14@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924' locally
docker.io/ocaml/opam@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924: Pulling from ocaml/opam
d59a9443a971: Pulling fs layer
d59a9443a971: Download complete
d59a9443a971: Pull complete
Digest: sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924
Status: Downloaded newer image for ocaml/opam@sha256:84f1ea72e62769bdd7b86dfcc73439eefde51836ecd9b9db0aa3e76235b47924
WARNING: The requested image's platform (linux/386) does not match the detected host platform (linux/amd64) and no specific platform was requested
2024-05-11 11:27.55 ---> using "8300366f591dd7d700d5b03820a25bee85616412b2b663c5565a5001ec202aae" from cache
/: (comment debian-12-4.14_x86_32_opam-2.1)
/: (user (uid 1000) (gid 1000))
/: (shell /usr/bin/linux32 /bin/sh -c)
/: (env CLICOLOR_FORCE 1)
/: (env OPAMCOLOR always)
/: (workdir /src)
/src: (run (shell "sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam"))
2024-05-11 11:27.55 ---> using "380c1a94df81dcbc9c0ef7845af2282896e8fb22e18048b65dc3c656bfa0e593" from cache
/src: (run (shell "opam init --reinit -ni"))
Configuring from /home/opam/.opamrc and then from built-in defaults.
Checking for available remotes: rsync and local, git.
- you won't be able to use mercurial repositories unless you install the hg command on your system.
- you won't be able to use darcs repositories unless you install the darcs command on your system.
This version of opam requires an update to the layout of /home/opam/.opam from version 2.0 to version 2.1, which can't be reverted.
You may want to back it up before going further.
Continue? [Y/n] y
Format upgrade done.
<><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file:///home/opam/opam-repository
2024-05-11 11:27.55 ---> using "7b839a80d0089fe77e7b5b2287b5b673446132cf247ccebb1294b44b775ce257" from cache
/src: (run (shell "uname -rs && opam exec -- ocaml -version && opam --version"))
Linux 5.15.0-101-generic
The OCaml toplevel, version 4.14.2
2.1.5
2024-05-11 11:27.55 ---> using "c9f39004818e8b7f49bfed208fe1cabaebb8be8a9564a13832a3a6b869acc85b" from cache
/src: (workdir /src)
/src: (run (shell "sudo chown opam /src"))
2024-05-11 11:27.55 ---> using "83884304c0495b8dbc96ed2844fc5c5bf875ffc0398a872acd76cbc9281d96c3" from cache
/src: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "cd ~/opam-repository && (git cat-file -e 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b || git fetch origin master) && git reset -q --hard 307e33d08fc4ccc1ea453ab45b0ead8ed574b97b && git log --no-decorate -n1 --oneline && opam update -u"))
From https://github.com/ocaml/opam-repository
* branch master -> FETCH_HEAD
eb2dcab0d8..2ae169d7d0 master -> origin/master
307e33d08f @dra27 and @Octachron maintain the 4.08+ packages
<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file:///home/opam/opam-repository
Everything as up-to-date as possible (run with --verbose to show unavailable upgrades).
However, you may "opam upgrade" these packages explicitly, which will ask permission to downgrade or uninstall the conflicting packages.
Nothing to do.
# Run eval $(opam env) to update the current shell environment
2024-05-11 11:27.55 ---> using "9c9d308969ebf9213675e78860f11c355e45cf027dca6f84584fdd13211961f6" from cache
/src: (copy (src iter.opam) (dst ./))
2024-05-11 11:27.55 ---> saved as "f72cd9d00929efde3e111d93f40bc45ca7447319d0103596b29475a6af7b47e0"
/src: (run (network host)
(shell "opam pin add -yn iter.dev './'"))
[iter.dev] synchronised (file:///src)
iter is now pinned to file:///src (version dev)
2024-05-11 11:27.58 ---> saved as "060b01177fdfb55987431268a289854e565db8e89481f60a84436b97ba4383c0"
/src: (env DEPS "astring.0.8.5 base-bigarray.base base-threads.base base-unix.base camlp-streams.5.0.1 cmdliner.1.2.0 cppo.1.6.9 csexp.1.5.2 dune.3.15.2 fmt.0.9.0 logs.0.7.0 mdx.2.4.1 ocaml.4.14.2 ocaml-base-compiler.4.14.2 ocaml-config.2 ocaml-options-vanilla.1 ocaml-version.3.6.7 ocamlbuild.0.14.3 ocamlfind.1.9.6 ounit2.2.2.7 qcheck-core.0.21.3 re.1.11.0 result.1.5 seq.base stdlib-shims.0.3.0 topkg.1.0.7")
/src: (env CI true)
/src: (env OCAMLCI true)
/src: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "opam update --depexts && opam install --cli=2.1 --depext-only -y iter.dev $DEPS"))
+ /usr/bin/sudo "apt-get" "update"
- Hit:1 http://deb.debian.org/debian bookworm InRelease
- Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
- Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
- Get:4 http://deb.debian.org/debian-security bookworm-security/main i386 Packages [154 kB]
- Fetched 257 kB in 0s (791 kB/s)
- Reading package lists...
-
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[iter.dev] synchronised (no changes)
[NOTE] Package ocaml-options-vanilla is already installed (current version is 1).
[NOTE] Package ocaml-config is already installed (current version is 2).
[NOTE] Package ocaml-base-compiler is already installed (current version is 4.14.2).
[NOTE] Package ocaml is already installed (current version is 4.14.2).
[NOTE] Package base-unix is already installed (current version is base).
[NOTE] Package base-threads is already installed (current version is base).
[NOTE] Package base-bigarray is already installed (current version is base).
2024-05-11 11:28.19 ---> saved as "ccc7632a9c79768cdd9aa9df2b912101a5dcc09845755bea1846ba322b9defc8"
/src: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))
(network host)
(shell "opam install $DEPS"))
[NOTE] Package ocaml-options-vanilla is already installed (current version is 1).
[NOTE] Package ocaml-config is already installed (current version is 2).
[NOTE] Package ocaml-base-compiler is already installed (current version is 4.14.2).
[NOTE] Package ocaml is already installed (current version is 4.14.2).
[NOTE] Package base-unix is already installed (current version is base).
[NOTE] Package base-threads is already installed (current version is base).
[NOTE] Package base-bigarray is already installed (current version is base).
The following actions will be performed:
- install ocamlbuild 0.14.3
- install cmdliner 1.2.0
- install ocamlfind 1.9.6
- install seq base
- install dune 3.15.2
- install topkg 1.0.7
- install stdlib-shims 0.3.0
- install result 1.5
- install re 1.11.0
- install qcheck-core 0.21.3
- install ocaml-version 3.6.7
- install csexp 1.5.2
- install cppo 1.6.9
- install camlp-streams 5.0.1
- install fmt 0.9.0
- install astring 0.8.5
- install ounit2 2.2.7
- install logs 0.7.0
- install mdx 2.4.1
===== 19 to install =====
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved camlp-streams.5.0.1 (cached)
-> retrieved astring.0.8.5 (cached)
-> retrieved cmdliner.1.2.0 (cached)
-> retrieved cppo.1.6.9 (cached)
-> retrieved csexp.1.5.2 (cached)
-> retrieved dune.3.15.2 (cached)
-> retrieved fmt.0.9.0 (cached)
-> retrieved logs.0.7.0 (cached)
-> retrieved mdx.2.4.1 (cached)
-> retrieved ocaml-version.3.6.7 (cached)
-> retrieved ocamlbuild.0.14.3 (cached)
-> retrieved ocamlfind.1.9.6 (cached)
-> retrieved ounit2.2.2.7 (cached)
-> retrieved qcheck-core.0.21.3 (cached)
-> installed seq.base
-> retrieved re.1.11.0 (cached)
-> retrieved result.1.5 (cached)
-> retrieved stdlib-shims.0.3.0 (cached)
-> retrieved topkg.1.0.7 (cached)
-> installed ocamlfind.1.9.6
-> installed cmdliner.1.2.0
-> installed ocamlbuild.0.14.3
-> installed topkg.1.0.7
-> installed fmt.0.9.0
-> installed astring.0.8.5
-> installed logs.0.7.0
-> installed dune.3.15.2
-> installed csexp.1.5.2
-> installed stdlib-shims.0.3.0
-> installed ocaml-version.3.6.7
-> installed result.1.5
-> installed camlp-streams.5.0.1
-> installed cppo.1.6.9
-> installed re.1.11.0
-> installed ounit2.2.2.7
-> installed qcheck-core.0.21.3
-> installed mdx.2.4.1
Done.
# Run eval $(opam env) to update the current shell environment
2024-05-11 11:29.52 ---> saved as "64645ea1724d1fb36bab1ab15b36ae554a58ef9e36a358353791ae4055e224df"
/src: (copy (src .) (dst /src))
2024-05-11 11:29.53 ---> saved as "59790f3cfb784b259095728710a6a2503f2d6d5403e8c55fca438190532a188c"
/src: (run (shell "opam exec -- dune build @install @check @runtest && rm -rf _build"))
File "benchs/dune", line 3, characters 17-26:
3 | (libraries iter benchmark)
^^^^^^^^^
Error: Library "benchmark" not found.
-> required by
_build/default/benchs/.bench_persistent_read.eobjs/byte/dune__exe__Bench_persistent.cmi
-> required by alias benchs/check
File "README.md", line 1, characters 0-0:
/usr/bin/git --no-pager diff --no-index --color=always -u _build/default/README.md _build/default/README.md.corrected
diff --git a/_build/default/README.md b/_build/default/README.md.corrected
index 4c8f158..51bb1ab 100644
--- a/_build/default/README.md
+++ b/_build/default/README.md.corrected
@@ -5,9 +5,11 @@ Clean and efficient loop fusion for all your iterating needs!
```ocaml
# #require "iter";;
+No such package: iter
# let p x = x mod 5 = 0 in
Iter.(1 -- 5_000 |> filter p |> map (fun x -> x * x) |> fold (+) 0);;
-- : int = 8345837500
+Line 2, characters 3-7:
+Error: Unbound module Iter
```
`Iter` is a simple abstraction over `iter` functions
@@ -52,16 +54,20 @@ With iter, if the source structure provides a
# let q : int Queue.t = Queue.create();;
val q : int Queue.t = <abstr>
# Iter.( 1 -- 10 |> to_queue q);;
-- : unit = ()
+Line 1, characters 1-5:
+Error: Unbound module Iter
# Iter.of_queue q |> Iter.to_list ;;
-- : int list = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
+Line 1, characters 20-32:
+Error: Unbound module Iter
# let s : int Stack.t = Stack.create();;
val s : int Stack.t = <abstr>
# Iter.(of_queue q |> to_stack s);;
-- : unit = ()
+Line 1, characters 1-5:
+Error: Unbound module Iter
# Iter.of_stack s |> Iter.to_list ;;
-- : int list = [10; 9; 8; 7; 6; 5; 4; 3; 2; 1]
+Line 1, characters 20-32:
+Error: Unbound module Iter
```
Note how the list of elements is reversed when we transfer them
@@ -84,7 +90,8 @@ val h : (int, string) Hashtbl.t = <abstr>
# (* now to get the values *)
Iter.of_hashtbl h |> Iter.map snd |> Iter.to_list;;
-- : string list = ["6"; "2"; "8"; "7"; "3"; "5"; "4"; "9"; "0"; "10"; "1"]
+Line 2, characters 40-52:
+Error: Unbound module Iter
```
### Replacing `for` loops
@@ -95,7 +102,8 @@ use `Iter.(--) : int -> int -> int Iter.t`.
```ocaml
# Iter.(1 -- 10_000_000 |> fold (+) 0);;
-- : int = 50000005000000
+Line 1, characters 1-5:
+Error: Unbound module Iter
# let p x = x mod 5 = 0 in
Iter.(1 -- 5_000
@@ -103,7 +111,8 @@ use `Iter.(--) : int -> int -> int Iter.t`.
|> map (fun x -> x * x)
|> fold (+) 0
);;
-- : int = 8345837500
+Line 2, characters 3-7:
+Error: Unbound module Iter
```
**NOTE**: with _flambda_ under sufficiently strong
@@ -131,20 +140,24 @@ type term = Var of string | App of term * term | Lambda of term
| App (a,b) ->
Iter.append (subterms a) (subterms b))
;;
-val subterms : term -> term Iter.t = <fun>
+Line 1, characters 33-39:
+Error: Unbound module Iter
# (* Now we can define many other functions easily! *)
let vars t =
Iter.filter_map
(function Var s -> Some s | _ -> None)
(subterms t) ;;
-val vars : term -> string Iter.t = <fun>
+Line 3, characters 5-20:
+Error: Unbound module Iter
# let size t = Iter.length (subterms t) ;;
-val size : term -> int = <fun>
+Line 1, characters 14-25:
+Error: Unbound module Iter
# let vars_list l = Iter.(of_list l |> flat_map vars);;
-val vars_list : term list -> string Iter.t = <fun>
+Line 1, characters 19-23:
+Error: Unbound module Iter
```
### Permutations
@@ -157,21 +170,26 @@ enumerating the ways we can insert an element in a list.
```ocaml
# open Iter.Infix;;
+Line 1, characters 6-16:
+Error: Unbound module Iter
# let rec insert x l = match l with
| [] -> Iter.return [x]
| y :: tl ->
Iter.append
(insert x tl >|= fun tl' -> y :: tl')
(Iter.return (x :: l)) ;;
-val insert : 'a -> 'a list -> 'a list Iter.t = <fun>
+Line 2, characters 11-22:
+Error: Unbound module Iter
# let rec permute l = match l with
| [] -> Iter.return []
| x :: tl -> permute tl >>= insert x ;;
-val permute : 'a list -> 'a list Iter.t = <fun>
+Line 2, characters 11-22:
+Error: Unbound module Iter
# permute [1;2;3;4] |> Iter.take 2 |> Iter.to_list ;;
-- : int list list = [[4; 3; 2; 1]; [4; 3; 1; 2]]
+Line 1, characters 37-49:
+Error: Unbound module Iter
```
### Advanced example
(cd _build/default && /home/opam/.opam/4.14/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -w +a -warn-error -a+8 -strict-sequence -w +a -warn-error -a+8 -nolabels -g -bin-annot -I src/.iter.objs/byte -intf-suffix .ml -no-alias-deps -opaque -o src/.iter.objs/byte/iter.cmo -c -impl src/Iter.ml)
File "src/Iter.ml", lines 204-209, characters 6-33:
204 | ......match !acc with
205 | | Nil -> acc := !cur
206 | | _ ->
207 | (match !tail with
208 | | Nil -> ()
209 | | Cons r -> r.tl <- !cur)
Warning 4 [fragile-match]: this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type node.
(cd _build/default && /home/opam/.opam/4.14/bin/ocamlopt.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -w +a -warn-error -a+8 -strict-sequence -w +a -warn-error -a+8 -nolabels -g -O3 -unbox-closures -unbox-closures-factor 20 -I src/.iter.objs/byte -I src/.iter.objs/native -intf-suffix .ml -no-alias-deps -opaque -o src/.iter.objs/native/iter.cmx -c -impl src/Iter.ml)
File "src/Iter.ml", lines 204-209, characters 6-33:
204 | ......match !acc with
205 | | Nil -> acc := !cur
206 | | _ ->
207 | (match !tail with
208 | | Nil -> ()
209 | | Cons r -> r.tl <- !cur)
Warning 4 [fragile-match]: this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type node.
(cd _build/default/tests/unit && ./t_iter.exe)
random seed: 122060321
================================================================================
success (ran 4 tests)
"/usr/bin/linux32" "/bin/sh" "-c" "opam exec -- dune build @install @check @runtest && rm -rf _build" failed with exit status 1
2024-05-11 11:29.55: Job failed: Failed: Build failed