[m-rev.] diff: additional modes for folds over sparse_bitsets

Julien Fischer jfischer at opturion.com
Fri Apr 10 10:26:20 AEST 2015


Additional modes for folds over sparse_bitsets.

library/sparse_bitset.m:
library/fat_sparse_bitset.m:
 	Add modes for folds with unique and mostly-unique accumulators.

library/diet.m:
 	Fix some formatting.

Julien.

diff --git a/library/diet.m b/library/diet.m
index 612530b..b6410cf 100644
--- a/library/diet.m
+++ b/library/diet.m
@@ -1128,7 +1128,7 @@ split(X, Set, Lesser, IsPresent, Greater) :-
              split(X, L, Lesser, IsPresent, RL),
              Greater = join({A, B}, RL, R)
          ; B < X ->
-			split(X, R, LR, IsPresent, Greater),
+            split(X, R, LR, IsPresent, Greater),
              Lesser = join({A, B}, L, LR)
          ;
              IsPresent = yes,
diff --git a/library/fat_sparse_bitset.m b/library/fat_sparse_bitset.m
index 20eff2e..28e87a2 100644
--- a/library/fat_sparse_bitset.m
+++ b/library/fat_sparse_bitset.m
@@ -260,27 +260,35 @@
  :- func foldl(func(T, U) = U, fat_sparse_bitset(T), U) = U <= enum(T).

  :- pred foldl(pred(T, U, U), fat_sparse_bitset(T), U, U) <= enum(T).
-:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldl(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode foldl(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode foldl(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode foldl(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode foldl(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode foldl(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode foldl(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pred foldl2(pred(T, U, U, V, V), fat_sparse_bitset(T), U, U, V, V)
      <= enum(T).
-:- mode foldl2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
-:- mode foldl2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
  :- mode foldl2(pred(in, in, out, in, out) is det, in, in, out, in, out) is det.
+:- mode foldl2(pred(in, in, out, mdi, muo) is det, in, in, out, mdi, muo) is det.
+:- mode foldl2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
+:- mode foldl2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
  :- mode foldl2(pred(in, in, out, in, out) is semidet, in, in, out, in, out)
      is semidet.
+:- mode foldl2(pred(in, in, out, mdi, muo) is semidet, in, in, out, mdi, muo)
+    is semidet.
+:- mode foldl2(pred(in, in, out, di, uo) is semidet, in, in, out, di, uo)
+    is semidet.
  :- mode foldl2(pred(in, in, out, in, out) is nondet, in, in, out, in, out)
      is nondet.
-:- mode foldl2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
+:- mode foldl2(pred(in, in, out, in, out) is cc_multi, in, in, out, in, out)
      is cc_multi.
  :- mode foldl2(pred(in, in, out, di, uo) is cc_multi, in, in, out, di, uo)
      is cc_multi.
-:- mode foldl2(pred(in, in, out, in, out) is cc_multi, in, in, out, in, out)
+:- mode foldl2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
      is cc_multi.

      % `foldr(Func, Set, Start)' calls Func with each element of `Set'
@@ -290,20 +298,28 @@
  :- func foldr(func(T, U) = U, fat_sparse_bitset(T), U) = U <= enum(T).

  :- pred foldr(pred(T, U, U), fat_sparse_bitset(T), U, U) <= enum(T).
-:- mode foldr(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldr(pred(in, in, out) is det, in, in, out) is det.
+:- mode foldr(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode foldr(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldr(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode foldr(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode foldr(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode foldr(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode foldr(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode foldr(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode foldr(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pred foldr2(pred(T, U, U, V, V), fat_sparse_bitset(T), U, U, V, V)
      <= enum(T).
-:- mode foldr2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
-:- mode foldr2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
  :- mode foldr2(pred(in, in, out, in, out) is det, in, in, out, in, out) is det.
+:- mode foldr2(pred(in, in, out, mdi, muo) is det, in, in, out, mdi, muo) is det.
+:- mode foldr2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
+:- mode foldr2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
  :- mode foldr2(pred(in, in, out, in, out) is semidet, in, in, out, in, out)
      is semidet.
+:- mode foldr2(pred(in, in, out, mdi, muo) is semidet, in, in, out, mdi, muo)
+    is semidet.
+:- mode foldr2(pred(in, in, out, di, uo) is semidet, in, in, out, di, uo)
+    is semidet.
  :- mode foldr2(pred(in, in, out, in, out) is nondet, in, in, out, in, out)
      is nondet.
  :- mode foldr2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
@@ -486,12 +502,15 @@ foldl2(P, fat_sparse_bitset(Set), !Acc1, !Acc2) :-
      do_foldl2_pred(P, Set, !Acc1, !Acc2).

  :- pred do_foldl_pred(pred(T, U, U), fat_bitset_impl, U, U) <= enum(T).
-:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldl_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode do_foldl_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldl_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode do_foldl_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode do_foldl_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode do_foldl_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode do_foldl_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pragma type_spec(do_foldl_pred/4, T = int).
  :- pragma type_spec(do_foldl_pred/4, T = var(_)).
@@ -503,14 +522,20 @@ do_foldl_pred(P, node(Offset, Bits, Rest), !Acc) :-

  :- pred do_foldl2_pred(pred(T, U, U, V, V), fat_bitset_impl, U, U, V, V)
      <= enum(T).
+:- mode do_foldl2_pred(pred(in, in, out, in, out) is det,
+    in, in, out, in, out) is det.
+:- mode do_foldl2_pred(pred(in, in, out, mdi, muo) is det,
+    in, in, out, mdi, muo) is det.
  :- mode do_foldl2_pred(pred(in, di, uo, di, uo) is det,
      in, di, uo, di, uo) is det.
  :- mode do_foldl2_pred(pred(in, in, out, di, uo) is det,
      in, in, out, di, uo) is det.
-:- mode do_foldl2_pred(pred(in, in, out, in, out) is det,
-    in, in, out, in, out) is det.
  :- mode do_foldl2_pred(pred(in, in, out, in, out) is semidet,
      in, in, out, in, out) is semidet.
+:- mode do_foldl2_pred(pred(in, in, out, mdi, muo) is semidet,
+    in, in, out, mdi, muo) is semidet.
+:- mode do_foldl2_pred(pred(in, in, out, di, uo) is semidet,
+    in, in, out, di, uo) is semidet.
  :- mode do_foldl2_pred(pred(in, in, out, in, out) is nondet,
      in, in, out, in, out) is nondet.
  :- mode do_foldl2_pred(pred(in, di, uo, di, uo) is cc_multi,
@@ -541,9 +566,12 @@ foldr2(P, fat_sparse_bitset(Set), !Acc1, !Acc2) :-
      do_foldr2_pred(P, Set, !Acc1, !Acc2).

  :- pred do_foldr_pred(pred(T, U, U), fat_bitset_impl, U, U) <= enum(T).
-:- mode do_foldr_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldr_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode do_foldr_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode do_foldr_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldr_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode do_foldr_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode do_foldr_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode do_foldr_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
  :- mode do_foldr_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode do_foldr_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
@@ -561,14 +589,20 @@ do_foldr_pred(P, node(Offset, Bits, Rest), !Acc) :-

  :- pred do_foldr2_pred(pred(T, U, U, V, V), fat_bitset_impl, U, U, V, V)
      <= enum(T).
-:- mode do_foldr2_pred(pred(in, di, uo, di, uo) is det,
-    in, di, uo, di, uo) is det.
-:- mode do_foldr2_pred(pred(in, in, out, di, uo) is det,
-    in, in, out, di, uo) is det.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is det,
      in, in, out, in, out) is det.
+:- mode do_foldr2_pred(pred(in, in, out, mdi, muo) is det,
+    in, in, out, mdi, muo) is det.
+:- mode do_foldr2_pred(pred(in, in, out, di, uo) is det,
+    in, in, out, di, uo) is det.
+:- mode do_foldr2_pred(pred(in, di, uo, di, uo) is det,
+    in, di, uo, di, uo) is det.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is semidet,
      in, in, out, in, out) is semidet.
+:- mode do_foldr2_pred(pred(in, in, out, mdi, muo) is semidet,
+    in, in, out, mdi, muo) is semidet.
+:- mode do_foldr2_pred(pred(in, in, out, di, uo) is semidet,
+    in, in, out, di, uo) is semidet.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is nondet,
      in, in, out, in, out) is nondet.
  :- mode do_foldr2_pred(pred(in, di, uo, di, uo) is cc_multi,
@@ -594,10 +628,16 @@ do_foldr2_pred(P, node(Offset, Bits, Rest), !Acc1, !Acc2) :-
      int, int, int, U, U) <= enum(T).
  :- mode fold_bits(in, pred(in, in, out) is det,
      in, in, in, in, out) is det.
+:- mode fold_bits(in, pred(in, mdi, muo) is det,
+    in, in, in, mdi, muo) is det.
  :- mode fold_bits(in, pred(in, di, uo) is det,
      in, in, in, di, uo) is det.
  :- mode fold_bits(in, pred(in, in, out) is semidet,
      in, in, in, in, out) is semidet.
+:- mode fold_bits(in, pred(in, mdi, muo) is semidet,
+    in, in, in, mdi, muo) is semidet.
+:- mode fold_bits(in, pred(in, di, uo) is semidet,
+    in, in, in, di, uo) is semidet.
  :- mode fold_bits(in, pred(in, in, out) is nondet,
      in, in, in, in, out) is nondet.
  :- mode fold_bits(in, pred(in, di, uo) is cc_multi,
@@ -641,14 +681,20 @@ fold_bits(Dir, P, Offset, Bits, Size, !Acc) :-

  :- pred fold2_bits(fold_direction, pred(T, U, U, V, V),
      int, int, int, U, U, V, V) <= enum(T).
+:- mode fold2_bits(in, pred(in, in, out, in, out) is det,
+    in, in, in, in, out, in, out) is det.
+:- mode fold2_bits(in, pred(in, in, out, mdi, muo) is det,
+    in, in, in, in, out, mdi, muo) is det.
  :- mode fold2_bits(in, pred(in, di, uo, di, uo) is det,
      in, in, in, di, uo, di, uo) is det.
  :- mode fold2_bits(in, pred(in, in, out, di, uo) is det,
      in, in, in, in, out, di, uo) is det.
-:- mode fold2_bits(in, pred(in, in, out, in, out) is det,
-    in, in, in, in, out, in, out) is det.
  :- mode fold2_bits(in, pred(in, in, out, in, out) is semidet,
      in, in, in, in, out, in, out) is semidet.
+:- mode fold2_bits(in, pred(in, in, out, mdi, muo) is semidet,
+    in, in, in, in, out, mdi, muo) is semidet.
+:- mode fold2_bits(in, pred(in, in, out, di, uo) is semidet,
+    in, in, in, in, out, di, uo) is semidet.
  :- mode fold2_bits(in, pred(in, in, out, in, out) is nondet,
      in, in, in, in, out, in, out) is nondet.
  :- mode fold2_bits(in, pred(in, di, uo, di, uo) is cc_multi,
diff --git a/library/sparse_bitset.m b/library/sparse_bitset.m
index 7c48acd..02c8777 100644
--- a/library/sparse_bitset.m
+++ b/library/sparse_bitset.m
@@ -277,26 +277,34 @@
  :- func foldl(func(T, U) = U, sparse_bitset(T), U) = U <= enum(T).

  :- pred foldl(pred(T, U, U), sparse_bitset(T), U, U) <= enum(T).
-:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldl(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode foldl(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode foldl(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode foldl(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode foldl(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode foldl(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode foldl(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pred foldl2(pred(T, U, U, V, V), sparse_bitset(T), U, U, V, V) <= enum(T).
-:- mode foldl2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
-:- mode foldl2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
  :- mode foldl2(pred(in, in, out, in, out) is det, in, in, out, in, out) is det.
+:- mode foldl2(pred(in, in, out, mdi, muo) is det, in, in, out, mdi, muo) is det.
+:- mode foldl2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
+:- mode foldl2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
  :- mode foldl2(pred(in, in, out, in, out) is semidet, in, in, out, in, out)
      is semidet.
+:- mode foldl2(pred(in, in, out, mdi, muo) is semidet, in, in, out, mdi, muo)
+    is semidet.
+:- mode foldl2(pred(in, in, out, di, uo) is semidet, in, in, out, di, uo)
+    is semidet.
  :- mode foldl2(pred(in, in, out, in, out) is nondet, in, in, out, in, out)
      is nondet.
-:- mode foldl2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
+:- mode foldl2(pred(in, in, out, in, out) is cc_multi, in, in, out, in, out)
      is cc_multi.
  :- mode foldl2(pred(in, in, out, di, uo) is cc_multi, in, in, out, di, uo)
      is cc_multi.
-:- mode foldl2(pred(in, in, out, in, out) is cc_multi, in, in, out, in, out)
+:- mode foldl2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
      is cc_multi.

      % `foldr(Func, Set, Start)' calls Func with each element of `Set'
@@ -306,19 +314,27 @@
  :- func foldr(func(T, U) = U, sparse_bitset(T), U) = U <= enum(T).

  :- pred foldr(pred(T, U, U), sparse_bitset(T), U, U) <= enum(T).
-:- mode foldr(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldr(pred(in, in, out) is det, in, in, out) is det.
+:- mode foldr(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode foldr(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode foldr(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode foldr(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode foldr(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode foldr(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode foldr(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode foldr(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode foldr(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pred foldr2(pred(T, U, U, V, V), sparse_bitset(T), U, U, V, V) <= enum(T).
-:- mode foldr2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
-:- mode foldr2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
  :- mode foldr2(pred(in, in, out, in, out) is det, in, in, out, in, out) is det.
+:- mode foldr2(pred(in, in, out, mdi, muo) is det, in, in, out, mdi, muo) is det.
+:- mode foldr2(pred(in, in, out, di, uo) is det, in, in, out, di, uo) is det.
+:- mode foldr2(pred(in, di, uo, di, uo) is det, in, di, uo, di, uo) is det.
  :- mode foldr2(pred(in, in, out, in, out) is semidet, in, in, out, in, out)
      is semidet.
+:- mode foldr2(pred(in, in, out, mdi, muo) is semidet, in, in, out, mdi, muo)
+    is semidet.
+:- mode foldr2(pred(in, in, out, di, uo) is semidet, in, in, out, di, uo)
+    is semidet.
  :- mode foldr2(pred(in, in, out, in, out) is nondet, in, in, out, in, out)
      is nondet.
  :- mode foldr2(pred(in, di, uo, di, uo) is cc_multi, in, di, uo, di, uo)
@@ -499,12 +515,15 @@ foldl2(P, sparse_bitset(Set), !Acc1, !Acc2) :-
      do_foldl2_pred(P, Set, !Acc1, !Acc2).

  :- pred do_foldl_pred(pred(T, U, U), bitset_impl, U, U) <= enum(T).
-:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldl_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode do_foldl_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldl_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode do_foldl_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode do_foldl_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode do_foldl_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode do_foldl_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.

  :- pragma type_spec(do_foldl_pred/4, T = int).
  :- pragma type_spec(do_foldl_pred/4, T = var(_)).
@@ -516,14 +535,20 @@ do_foldl_pred(P, [H | T], !Acc) :-

  :- pred do_foldl2_pred(pred(T, U, U, V, V), bitset_impl, U, U, V, V)
      <= enum(T).
+:- mode do_foldl2_pred(pred(in, in, out, in, out) is det,
+    in, in, out, in, out) is det.
+:- mode do_foldl2_pred(pred(in, in, out, mdi, muo) is det,
+    in, in, out, mdi, muo) is det.
  :- mode do_foldl2_pred(pred(in, di, uo, di, uo) is det,
      in, di, uo, di, uo) is det.
  :- mode do_foldl2_pred(pred(in, in, out, di, uo) is det,
      in, in, out, di, uo) is det.
-:- mode do_foldl2_pred(pred(in, in, out, in, out) is det,
-    in, in, out, in, out) is det.
  :- mode do_foldl2_pred(pred(in, in, out, in, out) is semidet,
      in, in, out, in, out) is semidet.
+:- mode do_foldl2_pred(pred(in, in, out, mdi, muo) is semidet,
+    in, in, out, mdi, muo) is semidet.
+:- mode do_foldl2_pred(pred(in, in, out, di, uo) is semidet,
+    in, in, out, di, uo) is semidet.
  :- mode do_foldl2_pred(pred(in, in, out, in, out) is nondet,
      in, in, out, in, out) is nondet.
  :- mode do_foldl2_pred(pred(in, di, uo, di, uo) is cc_multi,
@@ -555,9 +580,12 @@ foldr2(P, sparse_bitset(Set), !Acc1, !Acc2) :-
      do_foldr2_pred(P, Set, !Acc1, !Acc2).

  :- pred do_foldr_pred(pred(T, U, U), bitset_impl, U, U) <= enum(T).
-:- mode do_foldr_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldr_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode do_foldr_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode do_foldr_pred(pred(in, di, uo) is det, in, di, uo) is det.
  :- mode do_foldr_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode do_foldr_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode do_foldr_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
  :- mode do_foldr_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
  :- mode do_foldr_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
  :- mode do_foldr_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
@@ -575,14 +603,20 @@ do_foldr_pred(P, [H | T], !Acc) :-

  :- pred do_foldr2_pred(pred(T, U, U, V, V), bitset_impl, U, U, V, V)
      <= enum(T).
-:- mode do_foldr2_pred(pred(in, di, uo, di, uo) is det,
-    in, di, uo, di, uo) is det.
-:- mode do_foldr2_pred(pred(in, in, out, di, uo) is det,
-    in, in, out, di, uo) is det.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is det,
      in, in, out, in, out) is det.
+:- mode do_foldr2_pred(pred(in, in, out, mdi, muo) is det,
+    in, in, out, mdi, muo) is det.
+:- mode do_foldr2_pred(pred(in, in, out, di, uo) is det,
+    in, in, out, di, uo) is det.
+:- mode do_foldr2_pred(pred(in, di, uo, di, uo) is det,
+    in, di, uo, di, uo) is det.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is semidet,
      in, in, out, in, out) is semidet.
+:- mode do_foldr2_pred(pred(in, in, out, mdi, muo) is semidet,
+    in, in, out, mdi, muo) is semidet.
+:- mode do_foldr2_pred(pred(in, in, out, di, uo) is semidet,
+    in, in, out, di, uo) is semidet.
  :- mode do_foldr2_pred(pred(in, in, out, in, out) is nondet,
      in, in, out, in, out) is nondet.
  :- mode do_foldr2_pred(pred(in, di, uo, di, uo) is cc_multi,
@@ -610,10 +644,16 @@ do_foldr2_pred(P, [H | T], !Acc1, !Acc2) :-
      int, int, int, U, U) <= enum(T).
  :- mode fold_bits(in, pred(in, in, out) is det,
      in, in, in, in, out) is det.
+:- mode fold_bits(in, pred(in, mdi, muo) is det,
+    in, in, in, mdi, muo) is det.
  :- mode fold_bits(in, pred(in, di, uo) is det,
      in, in, in, di, uo) is det.
  :- mode fold_bits(in, pred(in, in, out) is semidet,
      in, in, in, in, out) is semidet.
+:- mode fold_bits(in, pred(in, mdi, muo) is semidet,
+    in, in, in, mdi, muo) is semidet.
+:- mode fold_bits(in, pred(in, di, uo) is semidet,
+    in, in, in, di, uo) is semidet.
  :- mode fold_bits(in, pred(in, in, out) is nondet,
      in, in, in, in, out) is nondet.
  :- mode fold_bits(in, pred(in, di, uo) is cc_multi,
@@ -657,14 +697,20 @@ fold_bits(Dir, P, Offset, Bits, Size, !Acc) :-

  :- pred fold2_bits(fold_direction, pred(T, U, U, V, V),
      int, int, int, U, U, V, V) <= enum(T).
+:- mode fold2_bits(in, pred(in, in, out, in, out) is det,
+    in, in, in, in, out, in, out) is det.
+:- mode fold2_bits(in, pred(in, in, out, mdi, muo) is det,
+    in, in, in, in, out, mdi, muo) is det.
  :- mode fold2_bits(in, pred(in, di, uo, di, uo) is det,
      in, in, in, di, uo, di, uo) is det.
  :- mode fold2_bits(in, pred(in, in, out, di, uo) is det,
      in, in, in, in, out, di, uo) is det.
-:- mode fold2_bits(in, pred(in, in, out, in, out) is det,
-    in, in, in, in, out, in, out) is det.
  :- mode fold2_bits(in, pred(in, in, out, in, out) is semidet,
      in, in, in, in, out, in, out) is semidet.
+:- mode fold2_bits(in, pred(in, in, out, mdi, muo) is semidet,
+    in, in, in, in, out, mdi, muo) is semidet.
+:- mode fold2_bits(in, pred(in, in, out, di, uo) is semidet,
+    in, in, in, in, out, di, uo) is semidet.
  :- mode fold2_bits(in, pred(in, in, out, in, out) is nondet,
      in, in, in, in, out, in, out) is nondet.
  :- mode fold2_bits(in, pred(in, di, uo, di, uo) is cc_multi,



More information about the reviews mailing list