[m-rev.] diff: library cleanups

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 23 10:11:35 AEST 2006


Estimated hours taken: 1
Branches: main

Various minor cleanups and syntax updates for the standard library.
There are no changes to any algorithms.

library/injection.m:
library/set.m:
library/sparse_bitset.m:
 	Use promise_equivalent_clauses where appropriate.

library/set_ordlist.m:
library/set_unordlist.m:
 	Convert these module to 4-space indentation:
 		Convert these module to 4-space indentation

library/*.m:
 	Convert some if-then-elses into switches.

 	Remove unnecessary module qualification - this is related
 	mainly to the breakup of std_util and the fact that on
 	the 0.13 branch we had to support two versions of the
 	all-solutions predicates.

 	Various other style cleanups.

vim/syntax/mercury.vim:
 	Highlight promise_equivalent_clauses appropriately.

Julien.

Index: library/array.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.148
diff -u -r1.148 array.m
--- library/array.m	7 Sep 2006 08:32:20 -0000	1.148
+++ library/array.m	20 Oct 2006 12:42:43 -0000
@@ -1274,7 +1274,7 @@
          % Do a Compare to check.
          ( Width = 0 ->
              array.lookup(Array, Lo, X),
-            ( call(Compare, El, X, (=)) ->
+            ( Compare(El, X, (=)) ->
                  Result = yes(Lo)
              ;
                  Result = no
@@ -1284,7 +1284,7 @@
              % and check against that.
              Mid = (Lo + Hi) >> 1,   % `>> 1' is hand-optimized `div 2'.
              array.lookup(Array, Mid, XMid),
-            call(Compare, XMid, El, Comp),
+            Compare(XMid, El, Comp),
              (
                  Comp = (<),
                  Mid1 = Mid + 1,
@@ -1305,10 +1305,9 @@
  array.map(Closure, OldArray, NewArray) :-
      ( array.semidet_lookup(OldArray, 0, Elem0) ->
          array.size(OldArray, Size),
-        call(Closure, Elem0, Elem),
+        Closure(Elem0, Elem),
          array.init(Size, Elem, NewArray0),
-        array.map_2(1, Size, Closure, OldArray,
-        NewArray0, NewArray)
+        array.map_2(1, Size, Closure, OldArray, NewArray0, NewArray)
      ;
          array.make_empty_array(NewArray)
      ).
Index: library/assoc_list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/assoc_list.m,v
retrieving revision 1.23
diff -u -r1.23 assoc_list.m
--- library/assoc_list.m	27 Jul 2006 05:03:38 -0000	1.23
+++ library/assoc_list.m	20 Oct 2006 15:27:25 -0000
@@ -24,22 +24,22 @@

  %-----------------------------------------------------------------------------%

-:- type assoc_list(K,V) ==  list(pair(K,V)).
+:- type assoc_list(K, V) ==  list(pair(K, V)).

-:- type assoc_list(T)   ==  list(pair(T,T)).
+:- type assoc_list(T)   ==  list(pair(T, T)).

      % Swap the two sides of the pairs in each member of the list.
      %
+:- func assoc_list.reverse_members(assoc_list(K, V)) = assoc_list(V, K).
  :- pred assoc_list.reverse_members(assoc_list(K, V)::in,
      assoc_list(V, K)::out) is det.
-:- func assoc_list.reverse_members(assoc_list(K, V)) = assoc_list(V, K).

      % Zip together two lists; abort if they are of different lengths.
      %
-:- pred assoc_list.from_corresponding_lists(list(K)::in, list(V)::in,
-    assoc_list(K,V)::out) is det.
  :- func assoc_list.from_corresponding_lists(list(K), list(V))
-    = assoc_list(K,V).
+    = assoc_list(K, V).
+:- pred assoc_list.from_corresponding_lists(list(K)::in, list(V)::in,
+    assoc_list(K, V)::out) is det.

      % Return the first member of each pair.
      %
@@ -48,8 +48,8 @@

      % Return the second member of each pair.
      %
-:- pred assoc_list.values(assoc_list(K, V)::in, list(V)::out) is det.
  :- func assoc_list.values(assoc_list(K, V)) = list(V).
+:- pred assoc_list.values(assoc_list(K, V)::in, list(V)::out) is det.

      % Return the two lists contain respectively the first and second member
      % of each pair in the assoc_list.
@@ -64,7 +64,7 @@

      % An alternative version of assoc_list.search.
      %
-:- func assoc_list(K, V) ^ elem(K)     = V is semidet.
+:- func assoc_list(K, V) ^ elem(K) = V is semidet.

      % An alternative version of assoc_list.search that throws an
      % exception if the key in question does not appear in the assoc_list.
Index: library/bag.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bag.m,v
retrieving revision 1.30
diff -u -r1.30 bag.m
--- library/bag.m	19 Apr 2006 05:17:49 -0000	1.30
+++ library/bag.m	20 Oct 2006 13:14:10 -0000
@@ -22,6 +22,8 @@
  :- import_module list.
  :- import_module set.

+%---------------------------------------------------------------------------%
+
  :- type bag(T).

      % Create an empty bag.
Index: library/bimap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bimap.m,v
retrieving revision 1.27
diff -u -r1.27 bimap.m
--- library/bimap.m	19 Apr 2006 05:17:49 -0000	1.27
+++ library/bimap.m	20 Oct 2006 13:20:42 -0000
@@ -302,7 +302,8 @@
  :- import_module pair.
  :- import_module require.

-:- type bimap(K, V) --->    bimap(map(K, V), map(V, K)).
+:- type bimap(K, V)
+    --->    bimap(map(K, V), map(V, K)).

  %-----------------------------------------------------------------------------%

Index: library/bt_array.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bt_array.m,v
retrieving revision 1.18
diff -u -r1.18 bt_array.m
--- library/bt_array.m	27 Sep 2006 06:16:37 -0000	1.18
+++ library/bt_array.m	20 Oct 2006 14:48:50 -0000
@@ -409,7 +409,7 @@
      % Do a Compare to check.
      ( Width = 0 ->
          lookup(A, Lo, X),
-        call(Compare, El, X, (=)),
+        Compare(El, X, (=)),
          I = Lo
      ;
          % Otherwise find the middle element of the range and check against
@@ -422,7 +422,7 @@

          Mid = (Lo + Hi) >> 1,
          lookup(A, Mid, XMid),
-        call(Compare, XMid, El, Comp),
+        Compare(XMid, El, Comp),
          ( Comp = (<),
              Mid1 = Mid + 1,
              bsearch_2(A, Mid1, Hi, El, Compare, I)
Index: library/builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.124
diff -u -r1.124 builtin.m
--- library/builtin.m	27 Sep 2006 09:09:36 -0000	1.124
+++ library/builtin.m	20 Oct 2006 14:54:59 -0000
@@ -450,7 +450,7 @@

  get_one_solution(CCPred) = OutVal :-
      impure Pred = cc_cast(CCPred),
-    call(Pred, OutVal).
+    Pred(OutVal).

  :- impure func cc_cast(pred(T)) = pred(T).
  :- mode cc_cast(pred(out) is cc_nondet) = out(pred(out) is semidet) is det.
@@ -500,7 +500,7 @@

  get_one_solution_io(Pred, X, !IO) :-
      impure DetPred = cc_cast_io(Pred),
-    call(DetPred, X, !IO).
+    DetPred(X, !IO).

  :- impure func cc_cast_io(pred(T, IO, IO)) = pred(T, IO, IO).
  :- mode cc_cast_io(pred(out, di, uo) is cc_multi) =
Index: library/construct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.31
diff -u -r1.31 construct.m
--- library/construct.m	27 Sep 2006 09:09:37 -0000	1.31
+++ library/construct.m	20 Oct 2006 13:15:59 -0000
@@ -282,8 +282,7 @@

  null_to_no(S) = ( if null(S) then no else yes(S) ).

-:- pred null(string).
-:- mode null(in) is semidet.
+:- pred null(string::in) is semidet.

  :- pragma foreign_proc("C",
      null(S::in),
Index: library/getopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt.m,v
retrieving revision 1.40
diff -u -r1.40 getopt.m
--- library/getopt.m	19 Apr 2006 05:17:51 -0000	1.40
+++ library/getopt.m	20 Oct 2006 12:49:34 -0000
@@ -286,11 +286,10 @@

  :- import_module pair.
  :- import_module require.
+:- import_module solutions.
  :- import_module string.
  :- import_module svset.

-:- use_module solutions.
-
  % Please keep the differences between this module and getopt_io.m to the
  % minimum. Most changes should done in both modules.

@@ -331,16 +330,16 @@
      )).

  init_option_table(OptionDefaultsPred, OptionTable) :-
-    solutions.solutions((pred(OptionDataPair::out) is nondet :-
+    solutions((pred(OptionDataPair::out) is nondet :-
              OptionDataPair = Option - OptionData,
-            call(OptionDefaultsPred, Option, OptionData)
+            OptionDefaultsPred(Option, OptionData)
          ), OptionDefaultsList),
      map.from_assoc_list(OptionDefaultsList, OptionTable).

  init_option_table_multi(OptionDefaultsPred, OptionTable) :-
-    solutions.solutions((pred(OptionDataPair::out) is multi :-
+    solutions((pred(OptionDataPair::out) is multi :-
              OptionDataPair = Option - OptionData,
-            call(OptionDefaultsPred, Option, OptionData)
+            OptionDefaultsPred(Option, OptionData)
          ), OptionDefaultsList),
      map.from_assoc_list(OptionDefaultsList, OptionTable).

@@ -395,7 +394,7 @@
          Result = ok(OptionTable0)
      ; string.append("--no-", LongOption, Option) ->
          LongOptionPred = OptionOps ^ long_option,
-        ( call(LongOptionPred, LongOption, Flag) ->
+        ( LongOptionPred(LongOption, Flag) ->
              string.append("--", LongOption, OptName),
              process_negated_option(OptName, Flag, OptionOps,
                  OptionTable0, Result1, !OptionsSet),
@@ -430,7 +429,7 @@
              MaybeArg = no
          ),
          OptionName = "--" ++ LongOption,
-        ( call(LongOptionPred, LongOption, Flag) ->
+        ( LongOptionPred(LongOption, Flag) ->
              ( map.search(OptionTable0, Flag, OptionData) ->
                  getopt.handle_long_option(OptionName, Flag, OptionData,
                      MaybeArg, Args0, Args, OptionOps,
@@ -455,7 +454,7 @@
          % Process a single negated option `-x-'.
          ( ShortOptionsList = [SingleShortOpt, '-'] ->
              ShortOptionPred = OptionOps ^ short_option,
-            ( call(ShortOptionPred, SingleShortOpt, Flag) ->
+            ( ShortOptionPred(SingleShortOpt, Flag) ->
                  string.from_char_list(['-', SingleShortOpt], OptName),
                  process_negated_option(OptName, Flag, OptionOps,
                      OptionTable0, Result1, !OptionsSet),
@@ -516,12 +515,14 @@
          getopt.need_arg(OptionData, yes),
          MaybeOptionArg0 = no
      ->
-        ( Args0 = [Arg | ArgsTail] ->
+        (
+            Args0 = [Arg | ArgsTail],
              MaybeOptionArg = yes(Arg),
              Args1 = ArgsTail,
              MissingArg = no,
              OptionArgs1 = [Arg | OptionArgs0]
          ;
+            Args0 = [],
              MaybeOptionArg = no,
              Args1 = Args0,
              OptionArgs1 = OptionArgs0,
@@ -573,7 +574,7 @@
  getopt.handle_short_options([Opt | Opts0], OptionOps, Args0, Args,
          OptionArgs0, OptionArgs, OptionTable0, Result, !OptionsSet) :-
      ShortOptionPred = OptionOps ^ short_option,
-    ( call(ShortOptionPred, Opt, Flag) ->
+    ( ShortOptionPred(Opt, Flag) ->
          ( map.search(OptionTable0, Flag, OptionData) ->
              ( getopt.need_arg(OptionData, yes) ->
                  getopt.get_short_option_arg(Opts0, Arg, Args0, Args1,
@@ -862,7 +863,7 @@
      (
          MaybeHandler = notrack(Handler),
          (
-            call(Handler, Flag, OptionData, OptionTable0, Result0)
+            Handler(Flag, OptionData, OptionTable0, Result0)
          ->
              Result = Result0
          ;
@@ -873,7 +874,7 @@
      ;
          MaybeHandler = track(TrackHandler),
          (
-            call(TrackHandler, Flag, OptionData, OptionTable0, Result0,
+            TrackHandler(Flag, OptionData, OptionTable0, Result0,
                  NewOptionsSet)
          ->
              set.union(NewOptionsSet, !OptionsSet),
Index: library/getopt_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt_io.m,v
retrieving revision 1.9
diff -u -r1.9 getopt_io.m
--- library/getopt_io.m	19 Apr 2006 05:17:51 -0000	1.9
+++ library/getopt_io.m	20 Oct 2006 13:07:51 -0000
@@ -286,16 +286,16 @@
      list(string).

  %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

  :- implementation.

  :- import_module pair.
  :- import_module require.
+:- import_module solutions.
  :- import_module string.
  :- import_module svset.

-:- use_module solutions.
-
  % Please keep the differences between this module and getopt.m to the
  % minimum. Most changes should done in both modules.

@@ -336,16 +336,16 @@
      )).

  init_option_table(OptionDefaultsPred, OptionTable) :-
-    solutions.solutions((pred(OptionDataPair::out) is nondet :-
+    solutions((pred(OptionDataPair::out) is nondet :-
              OptionDataPair = Option - OptionData,
-            call(OptionDefaultsPred, Option, OptionData)
+            OptionDefaultsPred(Option, OptionData)
          ), OptionDefaultsList),
      map.from_assoc_list(OptionDefaultsList, OptionTable).

  init_option_table_multi(OptionDefaultsPred, OptionTable) :-
-    solutions.solutions((pred(OptionDataPair::out) is multi :-
+    solutions((pred(OptionDataPair::out) is multi :-
              OptionDataPair = Option - OptionData,
-            call(OptionDefaultsPred, Option, OptionData)
+            OptionDefaultsPred(Option, OptionData)
          ), OptionDefaultsList),
      map.from_assoc_list(OptionDefaultsList, OptionTable).

@@ -401,7 +401,7 @@
          Result = ok(OptionTable0)
      ; string.append("--no-", LongOption, Option) ->
          LongOptionPred = OptionOps ^ long_option,
-        ( call(LongOptionPred, LongOption, Flag) ->
+        ( LongOptionPred(LongOption, Flag) ->
              string.append("--", LongOption, OptName),
              process_negated_option(OptName, Flag, OptionOps,
                  OptionTable0, Result1, !OptionsSet),
@@ -436,7 +436,7 @@
              MaybeArg = no
          ),
          OptionName = "--" ++ LongOption,
-        ( call(LongOptionPred, LongOption, Flag) ->
+        ( LongOptionPred(LongOption, Flag) ->
              ( map.search(OptionTable0, Flag, OptionData) ->
                  getopt_io.handle_long_option(OptionName, Flag, OptionData,
                      MaybeArg, Args0, Args, OptionOps,
@@ -461,7 +461,7 @@
          % Process a single negated option `-x-'.
          ( ShortOptionsList = [SingleShortOpt, '-'] ->
              ShortOptionPred = OptionOps ^ short_option,
-            ( call(ShortOptionPred, SingleShortOpt, Flag) ->
+            ( ShortOptionPred(SingleShortOpt, Flag) ->
                  string.from_char_list(['-', SingleShortOpt], OptName),
                  process_negated_option(OptName, Flag, OptionOps,
                      OptionTable0, Result1, !OptionsSet),
@@ -523,12 +523,14 @@
          getopt_io.need_arg(OptionData, yes),
          MaybeOptionArg0 = no
      ->
-        ( Args0 = [Arg | ArgsTail] ->
+        ( 
+            Args0 = [Arg | ArgsTail],
              MaybeOptionArg = yes(Arg),
              Args1 = ArgsTail,
              MissingArg = no,
              OptionArgs1 = [Arg | OptionArgs0]
          ;
+            Args0 = [],
              MaybeOptionArg = no,
              Args1 = Args0,
              OptionArgs1 = OptionArgs0,
@@ -581,7 +583,7 @@
  getopt_io.handle_short_options([Opt | Opts0], OptionOps, Args0, Args,
          OptionArgs0, OptionArgs, OptionTable0, Result, !OptionsSet, !IO) :-
      ShortOptionPred = OptionOps ^ short_option,
-    ( call(ShortOptionPred, Opt, Flag) ->
+    ( ShortOptionPred(Opt, Flag) ->
          ( map.search(OptionTable0, Flag, OptionData) ->
              ( getopt_io.need_arg(OptionData, yes) ->
                  getopt_io.get_short_option_arg(Opts0, Arg, Args0, Args1,
@@ -913,7 +915,7 @@
      (
          MaybeHandler = notrack(Handler),
          (
-            call(Handler, Flag, OptionData, OptionTable0, Result0)
+            Handler(Flag, OptionData, OptionTable0, Result0)
          ->
              Result = Result0
          ;
@@ -924,7 +926,7 @@
      ;
          MaybeHandler = track(TrackHandler),
          (
-            call(TrackHandler, Flag, OptionData, OptionTable0, Result0,
+            TrackHandler(Flag, OptionData, OptionTable0, Result0,
                  NewOptionsSet)
          ->
              set.union(NewOptionsSet, !OptionsSet),
Index: library/graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.32
diff -u -r1.32 graph.m
--- library/graph.m	27 Sep 2006 06:16:39 -0000	1.32
+++ library/graph.m	20 Oct 2006 13:05:25 -0000
@@ -173,8 +173,7 @@
  :- import_module list.
  :- import_module map.
  :- import_module require.
-
-:- use_module solutions.
+:- import_module solutions.

  %------------------------------------------------------------------------------%

@@ -257,7 +256,7 @@
  %   SolnGoal = lambda([Node::out] is nondet,
  %           map.member(NodeTable, Node, NodeInfo)),
  %   solutions(SolnGoal, NodeList),
-    solutions.solutions(graph.select_node(NodeTable, NodeInfo), NodeList),
+    solutions(graph.select_node(NodeTable, NodeInfo), NodeList),
      set.sorted_list_to_set(NodeList, NodeSet).

  :- pred graph.select_node(map(node(N), N)::in, N::in, node(N)::out) is nondet.
Index: library/hash_table.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/hash_table.m,v
retrieving revision 1.17
diff -u -r1.17 hash_table.m
--- library/hash_table.m	27 Sep 2006 06:16:39 -0000	1.17
+++ library/hash_table.m	20 Oct 2006 13:19:32 -0000
@@ -90,17 +90,13 @@

      % Default hash_preds for ints and strings and everything (buwahahaha!)
      %
-:- pred int_double_hash(int, int, int).
-:- mode int_double_hash(in, out, out) is det.
+:- pred int_double_hash(int::in, int::out, int::out) is det.

-:- pred string_double_hash(string, int, int).
-:- mode string_double_hash(in, out, out) is det.
+:- pred string_double_hash(string::in, int::out, int::out) is det.

-:- pred char_double_hash(char, int, int).
-:- mode char_double_hash(in, out, out) is det.
+:- pred char_double_hash(char::in, int::out, int::out) is det.

-:- pred float_double_hash(float, int, int).
-:- mode float_double_hash(in, out, out) is det.
+:- pred float_double_hash(float::in, int::out, int::out) is det.

  :- pred generic_double_hash(T, int, int).
  :- mode generic_double_hash(in, out, out) is det.
Index: library/injection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/injection.m,v
retrieving revision 1.6
diff -u -r1.6 injection.m
--- library/injection.m	19 Apr 2006 05:17:52 -0000	1.6
+++ library/injection.m	20 Oct 2006 11:43:55 -0000
@@ -337,7 +337,7 @@

  injection.reverse_search(I, injection.reverse_search(I, V), V).

-:- pragma promise_pure(injection.search/3).
+:- pragma promise_equivalent_clauses(injection.search/3).

  injection.search(injection(F, _)::in, K::in, V::out) :-
      map.search(F, K, V0),
Index: library/integer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/integer.m,v
retrieving revision 1.26
diff -u -r1.26 integer.m
--- library/integer.m	27 Sep 2006 07:39:51 -0000	1.26
+++ library/integer.m	20 Oct 2006 12:40:02 -0000
@@ -631,8 +631,14 @@

  :- func mul_base(integer) = integer.

-mul_base(i(Len, Digits)) =
-    ( Digits = [] -> integer.zero ; i(Len + 1, mul_base_2(Digits)) ).
+mul_base(i(Len, Digits)) = Result :-
+    (
+        Digits = [],
+        Result = integer.zero
+    ;
+        Digits = [_ | _],
+        Result = i(Len + 1, mul_base_2(Digits))
+    ).

  :- func mul_base_2(list(digit)) = list(digit).

@@ -1052,7 +1058,7 @@
  :- func digits_to_string(list(digit)) = string.

  digits_to_string([]) = "0".
-digits_to_string(Digits @ [_|_]) = Str :-
+digits_to_string(Digits @ [_ | _]) = Str :-
      printbase_rep(printbase_pos_int_to_digits(base),
          Digits, i(_, DigitsInPrintBase)),
      ( DigitsInPrintBase = [Head | Tail] ->
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.359
diff -u -r1.359 io.m
--- library/io.m	9 Oct 2006 06:40:24 -0000	1.359
+++ library/io.m	20 Oct 2006 12:43:11 -0000
@@ -4378,7 +4378,7 @@

  io.write_list([], _Separator, _OutputPred, !IO).
  io.write_list([E | Es], Separator, OutputPred, !IO) :-
-    call(OutputPred, E, !IO),
+    OutputPred(E, !IO),
      (
          Es = []
      ;
Index: library/lexer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/lexer.m,v
retrieving revision 1.49
diff -u -r1.49 lexer.m
--- library/lexer.m	20 Sep 2006 09:42:24 -0000	1.49
+++ library/lexer.m	20 Oct 2006 13:00:12 -0000
@@ -1218,9 +1218,11 @@
      token::out, io::di, io::uo) is det.

  finish_hex_escape(QuoteChar, Chars, HexChars, Token, !IO) :-
-    ( HexChars = [] ->
+    (
+        HexChars = [],
          Token = error("empty hex escape")
      ;
+        HexChars = [_ | _],
          rev_char_list_to_string(HexChars, HexString),
          (
              string.base_string_to_int(16, HexString, Int),
@@ -1314,9 +1316,11 @@
      token::out, io::di, io::uo) is det.

  finish_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO) :-
-    ( OctalChars = [] ->
+    (
+        OctalChars = [],
          Token = error("empty octal escape")
      ;
+        OctalChars = [_ | _],
          rev_char_list_to_string(OctalChars, OctalString),
          (
              string.base_string_to_int(8, OctalString, Int),
Index: library/list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.155
diff -u -r1.155 list.m
--- library/list.m	27 Sep 2006 06:16:41 -0000	1.155
+++ library/list.m	20 Oct 2006 12:34:03 -0000
@@ -1656,9 +1656,11 @@
      list(list(T))::out) is det.

  list.chunk_2([], _ChunkSize, List0, _N, Lists) :-
-    ( List0 = [] ->
+    (
+        List0 = [],
          Lists = []
      ;
+        List0 = [_ | _],
          list.reverse(List0, List),
          Lists = [List]
      ).
Index: library/map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.107
diff -u -r1.107 map.m
--- library/map.m	16 Sep 2006 10:46:40 -0000	1.107
+++ library/map.m	20 Oct 2006 13:09:13 -0000
@@ -881,7 +881,7 @@
          compare(R, Key1, Key2),
          (
              R = (=),
-            call(CommonPred, Value1, Value2, Value),
+            CommonPred(Value1, Value2, Value),
              map.det_insert(Common0, Key1, Value, Common1),
              map.intersect_2(AssocTail1, AssocTail2, CommonPred,
                  Common1, Common)
@@ -985,7 +985,7 @@
          compare(R, Key1, Key2),
          (
              R = (=),
-            call(CommonPred, Value1, Value2, Value),
+            CommonPred(Value1, Value2, Value),
              map.det_insert(Common0, Key1, Value, Common1),
              map.union_2(AssocTail1, AssocTail2, CommonPred, Common1, Common)
          ;
Index: library/ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.66
diff -u -r1.66 ops.m
--- library/ops.m	25 Sep 2006 02:44:45 -0000	1.66
+++ library/ops.m	20 Oct 2006 15:25:52 -0000
@@ -136,6 +136,7 @@
  :- func ops.init_mercury_op_table = (ops.mercury_op_table::uo) is det.

  %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

  :- implementation.

Index: library/par_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/par_builtin.m,v
retrieving revision 1.6
diff -u -r1.6 par_builtin.m
--- library/par_builtin.m	26 Sep 2006 03:53:23 -0000	1.6
+++ library/par_builtin.m	20 Oct 2006 13:21:33 -0000
@@ -5,11 +5,11 @@
  % This file may only be copied under the terms of the GNU Library General
  % Public License - see the file COPYING.LIB in the Mercury distribution.
  %---------------------------------------------------------------------------%
-
+%
  % File: par_builtin.m.
  % Main authors: wangp.
  % Stability: low.
-
+%
  % This file is automatically imported, as if via `use_module', into every
  % module in lowlevel parallel grades.  It is intended for the builtin procedures
  % that the compiler generates implicit calls to when implementing parallel
@@ -18,14 +18,11 @@
  % This module is a private part of the Mercury implementation; user modules
  % should never explicitly import this module. The interface for this module
  % does not get included in the Mercury library reference manual.
-
+%
  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%

  :- module par_builtin.
-
-%-----------------------------------------------------------------------------%
-
  :- interface.

  :- type future(T).
@@ -55,6 +52,7 @@
  :- impure pred signal(future(T)::in, T::in) is det.

  %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

  :- implementation.

Index: library/parser.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/parser.m,v
retrieving revision 1.53
diff -u -r1.53 parser.m
--- library/parser.m	20 Sep 2006 09:42:24 -0000	1.53
+++ library/parser.m	20 Oct 2006 13:11:57 -0000
@@ -263,7 +263,8 @@

  parse_whole_term(Term, !PS) :-
      parse_term(Term0, !PS),
-    ( Term0 = ok(_) ->
+    ( 
+        Term0 = ok(_),
          ( parser_get_token(end, !PS) ->
              Term = Term0
          ;
@@ -271,6 +272,7 @@
          )
      ;
          % Propagate error upwards.
+        Term0 = error(_, _),
          Term = Term0
      ).

@@ -612,7 +614,8 @@

  parse_simple_term_2(open, _, _, Term, !PS) :-
      parse_term(Term0, !PS),
-    ( Term0 = ok(_) ->
+    (
+        Term0 = ok(_),
          ( parser_get_token(close, !PS) ->
              Term = Term0
          ;
@@ -620,6 +623,7 @@
          )
      ;
          % Propagate error upwards.
+        Term0 = error(_, _),
          Term = Term0
      ).

Index: library/rbtree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/rbtree.m,v
retrieving revision 1.27
diff -u -r1.27 rbtree.m
--- library/rbtree.m	27 Sep 2006 07:39:52 -0000	1.27
+++ library/rbtree.m	20 Oct 2006 12:44:48 -0000
@@ -1021,16 +1021,16 @@
  rbtree.map_values(_Pred, empty, empty).
  rbtree.map_values(Pred, Tree0, Tree) :-
      Tree0 = red(K0, V0, Left0, Right0),
-    Tree  = red(K0, W0, Left, Right),
-    call(Pred, K0, V0, W0),
+    Pred(K0, V0, W0),
      rbtree.map_values(Pred, Left0, Left),
-    rbtree.map_values(Pred, Right0, Right).
+    rbtree.map_values(Pred, Right0, Right),
+    Tree = red(K0, W0, Left, Right).
  rbtree.map_values(Pred, Tree0, Tree) :-
      Tree0 = black(K0, V0, Left0, Right0),
-    Tree  = black(K0, W0, Left, Right),
-    call(Pred, K0, V0, W0),
+    Pred(K0, V0, W0),
      rbtree.map_values(Pred, Left0, Left),
-    rbtree.map_values(Pred, Right0, Right).
+    rbtree.map_values(Pred, Right0, Right),
+    Tree = black(K0, W0, Left, Right).

  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%
Index: library/set.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set.m,v
retrieving revision 1.78
diff -u -r1.78 set.m
--- library/set.m	27 Sep 2006 06:16:42 -0000	1.78
+++ library/set.m	20 Oct 2006 11:44:27 -0000
@@ -387,7 +387,7 @@
  set.superset(SetA, SetB) :-
      set_ordlist.superset(SetA, SetB).

-:- pragma promise_pure(set.member/2).
+:- pragma promise_equivalent_clauses(set.member/2).

  set.member(X::in, Set::in) :-
      set_ordlist.is_member(X, Set, yes).
Index: library/set_ctree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_ctree234.m,v
retrieving revision 1.8
diff -u -r1.8 set_ctree234.m
--- library/set_ctree234.m	1 Oct 2006 04:14:54 -0000	1.8
+++ library/set_ctree234.m	20 Oct 2006 15:01:28 -0000
@@ -29,6 +29,8 @@
  :- import_module bool.
  :- import_module list.

+%--------------------------------------------------------------------------%
+
  :- type set_ctree234(_T).

      % `set_ctree234.init = Set' is true iff `Set' is an empty set.
@@ -2140,21 +2142,21 @@
  set_ctree234.do_fold_pred(_Pred, empty, !A).
  set_ctree234.do_fold_pred(Pred, two(E, T0, T1), !A) :-
      set_ctree234.do_fold_pred(Pred, T0, !A),
-    call(Pred, E, !A),
+    Pred(E, !A),
      set_ctree234.do_fold_pred(Pred, T1, !A).
  set_ctree234.do_fold_pred(Pred, three(E0, E1, T0, T1, T2), !A) :-
      set_ctree234.do_fold_pred(Pred, T0, !A),
-    call(Pred, E0, !A),
+    Pred(E0, !A),
      set_ctree234.do_fold_pred(Pred, T1, !A),
-    call(Pred, E1, !A),
+    Pred(E1, !A),
      set_ctree234.do_fold_pred(Pred, T2, !A).
  set_ctree234.do_fold_pred(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A) :-
      set_ctree234.do_fold_pred(Pred, T0, !A),
-    call(Pred, E0, !A),
+    Pred(E0, !A),
      set_ctree234.do_fold_pred(Pred, T1, !A),
-    call(Pred, E1, !A),
+    Pred(E1, !A),
      set_ctree234.do_fold_pred(Pred, T2, !A),
-    call(Pred, E2, !A),
+    Pred(E2, !A),
      set_ctree234.do_fold_pred(Pred, T3, !A).

  set_ctree234.fold(Pred, ct(_, Tin), A0) = A :-
@@ -2194,21 +2196,21 @@
  set_ctree234.do_fold2_pred(_Pred, empty, !A, !B).
  set_ctree234.do_fold2_pred(Pred, two(E, T0, T1), !A, !B) :-
      set_ctree234.do_fold2_pred(Pred, T0, !A, !B),
-    call(Pred, E, !A, !B),
+    Pred(E, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T1, !A, !B).
  set_ctree234.do_fold2_pred(Pred, three(E0, E1, T0, T1, T2), !A, !B) :-
      set_ctree234.do_fold2_pred(Pred, T0, !A, !B),
-    call(Pred, E0, !A, !B),
+    Pred(E0, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T1, !A, !B),
-    call(Pred, E1, !A, !B),
+    Pred(E1, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T2, !A, !B).
  set_ctree234.do_fold2_pred(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B) :-
      set_ctree234.do_fold2_pred(Pred, T0, !A, !B),
-    call(Pred, E0, !A, !B),
+    Pred(E0, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T1, !A, !B),
-    call(Pred, E1, !A, !B),
+    Pred(E1, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T2, !A, !B),
-    call(Pred, E2, !A, !B),
+    Pred(E2, !A, !B),
      set_ctree234.do_fold2_pred(Pred, T3, !A, !B).

  %------------------------------------------------------------------------------%
@@ -2224,28 +2226,28 @@
  set_ctree234.map_pred(Pred, Tin, !List) :-
      Tin = two(E0, T0, T1),
      set_ctree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_ctree234.map_pred(Pred, T1, !List).
  set_ctree234.map_pred(Pred, Tin, !List) :-
      Tin = three(E0, E1, T0, T1, T2),
      set_ctree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_ctree234.map_pred(Pred, T1, !List),
-    call(Pred, E1, N1),
+    Pred(E1, N1),
      !:List = [N1 | !.List],
      set_ctree234.map_pred(Pred, T2, !List).
  set_ctree234.map_pred(Pred, Tin, !List) :-
      Tin = four(E0, E1, E2, T0, T1, T2, T3),
      set_ctree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_ctree234.map_pred(Pred, T1, !List),
-    call(Pred, E1, N1),
+    Pred(E1, N1),
      !:List = [N1 | !.List],
      set_ctree234.map_pred(Pred, T2, !List),
-    call(Pred, E2, N2),
+    Pred(E2, N2),
      !:List = [N2 | !.List],
      set_ctree234.map_pred(Pred, T3, !List).

Index: library/set_ordlist.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_ordlist.m,v
retrieving revision 1.27
diff -u -r1.27 set_ordlist.m
--- library/set_ordlist.m	19 Apr 2006 05:17:56 -0000	1.27
+++ library/set_ordlist.m	20 Oct 2006 11:49:14 -0000
@@ -1,4 +1,6 @@
  %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
  % Copyright (C) 1996-1997,1999-2002, 2004-2006 The University of Melbourne.
  % This file may only be copied under the terms of the GNU Library General
  % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -24,222 +26,222 @@

  :- type set_ordlist(_T).

-	% `set_ordlist.list_to_set(List, Set)' is true iff `Set' is the set
-	% containing only the members of `List'.
-	%
+    % `set_ordlist.list_to_set(List, Set)' is true iff `Set' is the set
+    % containing only the members of `List'.
+    %
  :- pred set_ordlist.list_to_set(list(T)::in, set_ordlist(T)::out) is det.
  :- func set_ordlist.list_to_set(list(T)) = set_ordlist(T).

-	% A synonym for set_ordlist.list_to_set/1.
-	%
+    % A synonym for set_ordlist.list_to_set/1.
+    %
  :- func set_ordlist.from_list(list(T)) = set_ordlist(T).

-	% `set_ordlist.sorted_list_to_set(List, Set)' is true iff `Set' is
-	% the set containing only the members of `List'.  `List' must be sorted.
-	%
+    % `set_ordlist.sorted_list_to_set(List, Set)' is true iff `Set' is
+    % the set containing only the members of `List'.  `List' must be sorted.
+    %
  :- pred set_ordlist.sorted_list_to_set(list(T)::in, set_ordlist(T)::out)
-	is det.
+    is det.
  :- func set_ordlist.sorted_list_to_set(list(T)) = set_ordlist(T).

-	% A synonym for set_ordrlist.sorted_list_to_set/1.
-	%
+    % A synonym for set_ordrlist.sorted_list_to_set/1.
+    %
  :- func set_ordlist.from_sorted_list(list(T)) = set_ordlist(T).

-	% `set_ordlist.to_sorted_list(Set, List)' is true iff `List' is the
-	% list of all the members of `Set', in sorted order.
-	%
+    % `set_ordlist.to_sorted_list(Set, List)' is true iff `List' is the
+    % list of all the members of `Set', in sorted order.
+    %
  :- pred set_ordlist.to_sorted_list(set_ordlist(T)::in, list(T)::out) is det.
  :- func set_ordlist.to_sorted_list(set_ordlist(T)) = list(T).

-	% `set_ordlist.init(Set)' is true iff `Set' is an empty set.
-	%
+    % `set_ordlist.init(Set)' is true iff `Set' is an empty set.
+    %
  :- pred set_ordlist.init(set_ordlist(_T)::uo) is det.
  :- func set_ordlist.init = set_ordlist(T).

-	% `set_ordlist.singleton_set(Set, Elem)' is true iff `Set' is the set
-	% containing just the single element `Elem'.
-	%
+    % `set_ordlist.singleton_set(Set, Elem)' is true iff `Set' is the set
+    % containing just the single element `Elem'.
+    %
  :- pred set_ordlist.singleton_set(set_ordlist(T), T).
  :- mode set_ordlist.singleton_set(in, out) is semidet.
  :- mode set_ordlist.singleton_set(out, in) is det.

  :- func set_ordlist.make_singleton_set(T) = set_ordlist(T).

-	% `set_ordlist.equal(SetA, SetB)' is true iff
-	% `SetA' and `SetB' contain the same elements.
-	%
+    % `set_ordlist.equal(SetA, SetB)' is true iff
+    % `SetA' and `SetB' contain the same elements.
+    %
  :- pred set_ordlist.equal(set_ordlist(T)::in, set_ordlist(T)::in) is semidet.

-	% `set_ordlist.empty(Set)' is true iff `Set' is an empty set.
-	%
+    % `set_ordlist.empty(Set)' is true iff `Set' is an empty set.
+    %
  :- pred set_ordlist.empty(set_ordlist(_T)::in) is semidet.

-	% `set_ordlist.subset(SetA, SetB)' is true iff `SetA' is a subset of
-	% `SetB'.
-	%
+    % `set_ordlist.subset(SetA, SetB)' is true iff `SetA' is a subset of
+    % `SetB'.
+    %
  :- pred set_ordlist.subset(set_ordlist(T)::in, set_ordlist(T)::in) is semidet.

-	% `set_ordlist.superset(SetA, SetB)' is true iff `SetA' is a
-	% superset of `SetB'.
-	%
+    % `set_ordlist.superset(SetA, SetB)' is true iff `SetA' is a
+    % superset of `SetB'.
+    %
  :- pred set_ordlist.superset(set_ordlist(T)::in, set_ordlist(T)::in)
-	is semidet.
+    is semidet.

-	% `set_ordlist.member(X, Set)' is true iff `X' is a member of `Set'.
-	%
+    % `set_ordlist.member(X, Set)' is true iff `X' is a member of `Set'.
+    %
  :- pred set_ordlist.member(T, set_ordlist(T)).
  :- mode set_ordlist.member(in, in) is semidet.
  :- mode set_ordlist.member(out, in) is nondet.

-	% `set_ordlist.is_member(X, Set, Result)' returns
-	% `Result = yes' iff `X' is a member of `Set'.
-	%
+    % `set_ordlist.is_member(X, Set, Result)' returns
+    % `Result = yes' iff `X' is a member of `Set'.
+    %
  :- pred set_ordlist.is_member(T::in, set_ordlist(T)::in, bool::out) is det.

-	% `set_ordlist.contains(Set, X)' is true iff `X' is a member of `Set'.
-	%
+    % `set_ordlist.contains(Set, X)' is true iff `X' is a member of `Set'.
+    %
  :- pred set_ordlist.contains(set_ordlist(T)::in, T::in) is semidet.

-	% `set_ordlist.insert(Set0, X, Set)' is true iff `Set' is the union
-	% of `Set0' and the set containing only `X'.
-	%
+    % `set_ordlist.insert(Set0, X, Set)' is true iff `Set' is the union
+    % of `Set0' and the set containing only `X'.
+    %
  :- pred set_ordlist.insert(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
-	is det.
+    is det.

  :- func set_ordlist.insert(set_ordlist(T), T) = set_ordlist(T).

-	% `set_ordlist.insert_list(Set0, Xs, Set)' is true iff `Set' is the
-	% union of `Set0' and the set containing only the members of `Xs'.
-	%
+    % `set_ordlist.insert_list(Set0, Xs, Set)' is true iff `Set' is the
+    % union of `Set0' and the set containing only the members of `Xs'.
+    %
  :- pred set_ordlist.insert_list(set_ordlist(T)::in, list(T)::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.
  :- func set_ordlist.insert_list(set_ordlist(T), list(T)) = set_ordlist(T).

-	% `set_ordlist.delete(Set0, X, Set)' is true iff `Set' is the
-	% relative complement of `Set0' and the set containing only `X', i.e.
-	% if `Set' is the set which contains all the elements of `Set0'
-	% except `X'.
-	%
+    % `set_ordlist.delete(Set0, X, Set)' is true iff `Set' is the
+    % relative complement of `Set0' and the set containing only `X', i.e.
+    % if `Set' is the set which contains all the elements of `Set0'
+    % except `X'.
+    %
  :- pred set_ordlist.delete(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
-	is det.
+    is det.
  :- func set_ordlist.delete(set_ordlist(T), T) = set_ordlist(T).

-	% `set_ordlist.delete_list(Set0, Xs, Set)' is true iff `Set' is the
-	% relative complement of `Set0' and the set containing only the members
-	% of `Xs'.
-	%
+    % `set_ordlist.delete_list(Set0, Xs, Set)' is true iff `Set' is the
+    % relative complement of `Set0' and the set containing only the members
+    % of `Xs'.
+    %
  :- pred set_ordlist.delete_list(set_ordlist(T)::in, list(T)::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.
  :- func set_ordlist.delete_list(set_ordlist(T), list(T)) = set_ordlist(T).

-	% `set_ordlist.remove(Set0, X, Set)' is true iff `Set0' contains `X',
-	% and `Set' is the relative complement of `Set0' and the set
-	% containing only `X', i.e.  if `Set' is the set which contains
-	% all the elements of `Set0' except `X'.
-	%
+    % `set_ordlist.remove(Set0, X, Set)' is true iff `Set0' contains `X',
+    % and `Set' is the relative complement of `Set0' and the set
+    % containing only `X', i.e.  if `Set' is the set which contains
+    % all the elements of `Set0' except `X'.
+    %
  :- pred set_ordlist.remove(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
-	is semidet.
+    is semidet.

-	% `set_ordlist.remove_list(Set0, Xs, Set)' is true iff Xs does not
-	% contain any duplicates, `Set0' contains every member of `Xs',
-	% and `Set' is the relative complement of `Set0' and the set
-	% containing only the members of `Xs'.
-	%
+    % `set_ordlist.remove_list(Set0, Xs, Set)' is true iff Xs does not
+    % contain any duplicates, `Set0' contains every member of `Xs',
+    % and `Set' is the relative complement of `Set0' and the set
+    % containing only the members of `Xs'.
+    %
  :- pred set_ordlist.remove_list(set_ordlist(T)::in, list(T)::in,
-	set_ordlist(T)::out) is semidet.
+    set_ordlist(T)::out) is semidet.

-	% `set_ordlist.remove_least(Set0, X, Set)' is true iff `X' is the
-	% least element in `Set0', and `Set' is the set which contains all the
-	% elements of `Set0' except `X'.
+    % `set_ordlist.remove_least(Set0, X, Set)' is true iff `X' is the
+    % least element in `Set0', and `Set' is the set which contains all the
+    % elements of `Set0' except `X'.

  :- pred set_ordlist.remove_least(set_ordlist(T)::in, T::out,
-	set_ordlist(T)::out) is semidet.
+    set_ordlist(T)::out) is semidet.

-	% `set_ordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
-	% of `SetA' and `SetB'. The efficiency of the union operation is
-	% O(card(SetA)+card(SetB)) and is not sensitive to the argument
-	% ordering.
-	%
+    % `set_ordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
+    % of `SetA' and `SetB'. The efficiency of the union operation is
+    % O(card(SetA)+card(SetB)) and is not sensitive to the argument
+    % ordering.
+    %
  :- pred set_ordlist.union(set_ordlist(T)::in, set_ordlist(T)::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.

  :- func set_ordlist.union(set_ordlist(T), set_ordlist(T)) = set_ordlist(T).

-	% `set_ordlist.union_list(A, B)' is true iff `B' is the union of
-	% all the sets in `A'
-	%
+    % `set_ordlist.union_list(A, B)' is true iff `B' is the union of
+    % all the sets in `A'
+    %
  :- func set_ordlist.union_list(list(set_ordlist(T))) = set_ordlist(T).

-	% `set_ordlist.power_union(A, B)' is true iff `B' is the union of
-	% all the sets in `A'
-	%
+    % `set_ordlist.power_union(A, B)' is true iff `B' is the union of
+    % all the sets in `A'
+    %
  :- pred set_ordlist.power_union(set_ordlist(set_ordlist(T))::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.

  :- func set_ordlist.power_union(set_ordlist(set_ordlist(T))) = set_ordlist(T).

-	% `set_ordlist.intersect(SetA, SetB, Set)' is true iff `Set' is the
-	% intersection of `SetA' and `SetB'. The efficiency of the intersection
-	% operation is not influenced by the argument order.
-	%
+    % `set_ordlist.intersect(SetA, SetB, Set)' is true iff `Set' is the
+    % intersection of `SetA' and `SetB'. The efficiency of the intersection
+    % operation is not influenced by the argument order.
+    %
  :- pred set_ordlist.intersect(set_ordlist(T), set_ordlist(T), set_ordlist(T)).
  :- mode set_ordlist.intersect(in, in, out) is det.
  :- mode set_ordlist.intersect(in, in, in) is semidet.

  :- func set_ordlist.intersect(set_ordlist(T), set_ordlist(T))
-	= set_ordlist(T).
+    = set_ordlist(T).

-	% `set_ordlist.power_intersect(A, B)' is true iff `B' is the
-	% intersection of all the sets in `A'.
-	%
+    % `set_ordlist.power_intersect(A, B)' is true iff `B' is the
+    % intersection of all the sets in `A'.
+    %
  :- pred set_ordlist.power_intersect(set_ordlist(set_ordlist(T))::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.
  :- func set_ordlist.power_intersect(set_ordlist(set_ordlist(T)))
-	= set_ordlist(T).
+    = set_ordlist(T).

-	% `set_ordlist.intersect_list(A, B)' is true iff `B' is the
-	% intersection of all the sets in `A'.
+    % `set_ordlist.intersect_list(A, B)' is true iff `B' is the
+    % intersection of all the sets in `A'.

  :- func set_ordlist.intersect_list(list(set_ordlist(T))) = set_ordlist(T).

-	% `set_ordlist.difference(SetA, SetB, Set)' is true iff `Set' is the
-	% set containing all the elements of `SetA' except those that
-	% occur in `SetB'.
-	%
+    % `set_ordlist.difference(SetA, SetB, Set)' is true iff `Set' is the
+    % set containing all the elements of `SetA' except those that
+    % occur in `SetB'.
+    %
  :- pred set_ordlist.difference(set_ordlist(T)::in, set_ordlist(T)::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.
  :- func set_ordlist.difference(set_ordlist(T), set_ordlist(T))
-	= set_ordlist(T).
+    = set_ordlist(T).

-	% `set_ordlist.count(Set, Count)' is true iff `Set' has
-	% `Count' elements.
-	%
+    % `set_ordlist.count(Set, Count)' is true iff `Set' has
+    % `Count' elements.
+    %
  :- pred set_ordlist.count(set_ordlist(T)::in, int::out) is det.
  :- func set_ordlist.count(set_ordlist(T)) = int.

  :- func set_ordlist.map(func(T1) = T2, set_ordlist(T1)) = set_ordlist(T2).

  :- func set_ordlist.filter_map(func(T1) = T2, set_ordlist(T1))
-	= set_ordlist(T2).
+    = set_ordlist(T2).
  :- mode set_ordlist.filter_map(func(in) = out is semidet, in) = out is det.

  :- func set_ordlist.fold(func(T1, T2) = T2, set_ordlist(T1), T2) = T2.

-	% set_ordlist.divide(Pred, Set, TruePart, FalsePart):
-	% TruePart consists of those elements of Set for which Pred succeeds;
-	% FalsePart consists of those elements of Set for which Pred fails.
-	%
+    % set_ordlist.divide(Pred, Set, TruePart, FalsePart):
+    % TruePart consists of those elements of Set for which Pred succeeds;
+    % FalsePart consists of those elements of Set for which Pred fails.
+    %
  :- pred set_ordlist.divide(pred(T)::in(pred(in) is semidet),
-	set_ordlist(T)::in, set_ordlist(T)::out, set_ordlist(T)::out)
-	is det.
+    set_ordlist(T)::in, set_ordlist(T)::out, set_ordlist(T)::out)
+    is det.

-	% set_ordlist.divide_by_set(DivideBySet, Set, InPart, OutPart):
-	% InPart consists of those elements of Set which are also in
-	% DivideBySet; OutPart consists of those elements of which are
-	% not in DivideBySet.
-	%
+    % set_ordlist.divide_by_set(DivideBySet, Set, InPart, OutPart):
+    % InPart consists of those elements of Set which are also in
+    % DivideBySet; OutPart consists of those elements of which are
+    % not in DivideBySet.
+    %
  :- pred set_ordlist.divide_by_set(set_ordlist(T)::in, set_ordlist(T)::in,
-	set_ordlist(T)::out, set_ordlist(T)::out) is det.
+    set_ordlist(T)::out, set_ordlist(T)::out) is det.

  %--------------------------------------------------------------------------%
  %--------------------------------------------------------------------------%
@@ -251,7 +253,7 @@

  :- interface.

-:- import_module term.	% for var/1.
+:- import_module term.  % for var/1.

  :- pragma type_spec(set_ordlist.list_to_set/2, T = var(_)).

@@ -275,40 +277,40 @@

  %-----------------------------------------------------------------------------%

-:- type set_ordlist(T)	==	  list(T).
+:- type set_ordlist(T)  ==    list(T).

  set_ordlist.list_to_set(List0, List) :-
-	list.sort_and_remove_dups(List0, List).
+    list.sort_and_remove_dups(List0, List).

  set_ordlist.from_list(List0) = List :-
-	set_ordlist.list_to_set(List0, List).
+    set_ordlist.list_to_set(List0, List).

  set_ordlist.sorted_list_to_set(List0, List) :-
-	list.remove_adjacent_dups(List0, List).
+    list.remove_adjacent_dups(List0, List).

  set_ordlist.from_sorted_list(List0) = List :-
-	set_ordlist.sorted_list_to_set(List0, List).
+    set_ordlist.sorted_list_to_set(List0, List).

  set_ordlist.to_sorted_list(List, List).

  set_ordlist.insert_list(Set0, List0, Set) :-
-	list.sort_and_remove_dups(List0, List),
-	set_ordlist.union(List, Set0, Set).
+    list.sort_and_remove_dups(List0, List),
+    set_ordlist.union(List, Set0, Set).

  set_ordlist.insert([], E, [E]).
  set_ordlist.insert([I|Is], E, Js) :-
-	compare(R, I, E),
-	(
-		R = (<),
-		set_ordlist.insert(Is, E, Ks),
-		Js = [I|Ks]
-	;
-		R = (=),
-		Js = [I|Is]
-	;
-		R = (>),
-		Js = [E,I|Is]
-	).
+    compare(R, I, E),
+    (
+        R = (<),
+        set_ordlist.insert(Is, E, Ks),
+        Js = [I | Ks]
+    ;
+        R = (=),
+        Js = [I | Is]
+    ;
+        R = (>),
+        Js = [E, I | Is]
+    ).

  set_ordlist.init([]).

@@ -319,260 +321,261 @@
  set_ordlist.empty([]).

  set_ordlist.subset(Subset, Set) :-
-	set_ordlist.intersect(Set, Subset, Subset).
+    set_ordlist.intersect(Set, Subset, Subset).

  set_ordlist.superset(Superset, Set) :-
-	set_ordlist.subset(Set, Superset).
+    set_ordlist.subset(Set, Superset).

-:- pragma promise_pure(set_ordlist.member/2).
+:- pragma promise_equivalent_clauses(set_ordlist.member/2).

  set_ordlist.member(E::out, S::in) :-
-	list.member(E, S).
+    list.member(E, S).
  set_ordlist.member(E::in, S::in) :-
-	set_ordlist.is_member(E, S, yes).
+    set_ordlist.is_member(E, S, yes).

  set_ordlist.is_member(_E, [], no).
  set_ordlist.is_member(E, [H | T], R) :-
-	compare(Res, H, E),
-	(
-		Res = (<),
-		set_ordlist.is_member(E, T, R)
-	;
-		Res = (=),
-		R = yes
-	;
-		Res = (>),
-		R = no
-	).
+    compare(Res, H, E),
+    (
+        Res = (<),
+        set_ordlist.is_member(E, T, R)
+    ;
+        Res = (=),
+        R = yes
+    ;
+        Res = (>),
+        R = no
+    ).

  set_ordlist.contains(S, E) :-
-	set_ordlist.member(E, S).
+    set_ordlist.member(E, S).

  set_ordlist.delete_list(S0, D, S) :-
-	list.sort_and_remove_dups(D, DS),
-	set_ordlist.difference(S0, DS, S).
+    list.sort_and_remove_dups(D, DS),
+    set_ordlist.difference(S0, DS, S).

  set_ordlist.delete(Set0, Elem, Set) :-
-	set_ordlist.difference(Set0, [Elem], Set).
+    set_ordlist.difference(Set0, [Elem], Set).

  set_ordlist.remove_list(Set0, Elems, Set) :-
-	set_ordlist.sort_no_dups(Elems, ElemSet),
-	set_ordlist.subset(ElemSet, Set0),
-	set_ordlist.difference(Set0, ElemSet, Set).
-
-	% set_ordlist.sort_no_dups(List, Set) is true iff
-	% List is a list with the same elements as Set and
-	% List contains no duplicates.
+    set_ordlist.sort_no_dups(Elems, ElemSet),
+    set_ordlist.subset(ElemSet, Set0),
+    set_ordlist.difference(Set0, ElemSet, Set).
+
+    % set_ordlist.sort_no_dups(List, Set) is true iff
+    % List is a list with the same elements as Set and
+    % List contains no duplicates.
+    %
  :- pred set_ordlist.sort_no_dups(list(T)::in, set_ordlist(T)::out) is semidet.

  set_ordlist.sort_no_dups(List, Set) :-
-	list.sort(List, Set),
-	(
-		Set = []
-	;
-		Set = [Elem|Elems],
-		set_ordlist.no_dups(Elem, Elems)
-	).
+    list.sort(List, Set),
+    (
+        Set = []
+    ;
+        Set = [Elem | Elems],
+        set_ordlist.no_dups(Elem, Elems)
+    ).

-	% set_ordlist.no_dups(Elem, Set) is true iff Set does not
-	% contain Elem, and Set does not contains duplicates.
+    % set_ordlist.no_dups(Elem, Set) is true iff Set does not
+    % contain Elem, and Set does not contains duplicates.
  :- pred set_ordlist.no_dups(T::in, list(T)::in) is semidet.

  set_ordlist.no_dups(_, []).
  set_ordlist.no_dups(Elem, [Elem0|Elems]) :-
-	Elem \= Elem0,
-	set_ordlist.no_dups(Elem0, Elems).
+    Elem \= Elem0,
+    set_ordlist.no_dups(Elem0, Elems).

  set_ordlist.remove(Set0, Elem, Set) :-
-	list.delete_first(Set0, Elem, Set).
+    list.delete_first(Set0, Elem, Set).

  set_ordlist.remove_least([Elem|Set], Elem, Set).

  set_ordlist.union(Set0, Set1, Set) :-
-	list.merge_and_remove_dups(Set0, Set1, Set).
+    list.merge_and_remove_dups(Set0, Set1, Set).

  set_ordlist.union_list(ListofSets) = Set :-
-	set_ordlist.init(Set0),
-	set_ordlist.power_union_2(ListofSets, Set0, Set).
+    set_ordlist.init(Set0),
+    set_ordlist.power_union_2(ListofSets, Set0, Set).

  set_ordlist.power_union(SetofSets, Set) :-
-	set_ordlist.init(Set0),
-	set_ordlist.power_union_2(SetofSets, Set0, Set).
+    set_ordlist.init(Set0),
+    set_ordlist.power_union_2(SetofSets, Set0, Set).

  :- pred set_ordlist.power_union_2(list(set_ordlist(T))::in, set_ordlist(T)::in,
-	set_ordlist(T)::out) is det.
+    set_ordlist(T)::out) is det.

  set_ordlist.power_union_2([], Set, Set).
-set_ordlist.power_union_2([NextSet|SetofSets], Set0, Set) :-
-	set_ordlist.union(Set0, NextSet, Set1),
-	set_ordlist.power_union_2(SetofSets, Set1, Set).
+set_ordlist.power_union_2([NextSet | SetofSets], Set0, Set) :-
+    set_ordlist.union(Set0, NextSet, Set1),
+    set_ordlist.power_union_2(SetofSets, Set1, Set).

  set_ordlist.intersect([], _, []).
-set_ordlist.intersect([_|_], [], []).
-set_ordlist.intersect([X|Xs], [Y|Ys], Set) :-
-	compare(R, X, Y),
-	(
-		R = (<),
-		set_ordlist.intersect(Xs, [Y|Ys], Set)
-	;
-		R = (=),
-		set_ordlist.intersect(Xs, Ys, Set0),
-		Set = [X|Set0]
-	;
-		R = (>),
-		set_ordlist.intersect([X|Xs], Ys, Set)
-	).
+set_ordlist.intersect([_ | _], [], []).
+set_ordlist.intersect([X | Xs], [Y | Ys], Set) :-
+    compare(R, X, Y),
+    (
+        R = (<),
+        set_ordlist.intersect(Xs, [Y|Ys], Set)
+    ;
+        R = (=),
+        set_ordlist.intersect(Xs, Ys, Set0),
+        Set = [X|Set0]
+    ;
+        R = (>),
+        set_ordlist.intersect([X|Xs], Ys, Set)
+    ).

  set_ordlist.power_intersect([], []).
-set_ordlist.power_intersect([S0|Ss], S) :-
-	(
-		Ss = []
-	->
-		S = S0
-	;
-		set_ordlist.power_intersect(Ss, S1),
-		set_ordlist.intersect(S1, S0, S)
-	).
+set_ordlist.power_intersect([S0 | Ss], S) :-
+    (
+        Ss = [],
+        S = S0
+    ;
+        Ss = [_ | _],
+        set_ordlist.power_intersect(Ss, S1),
+        set_ordlist.intersect(S1, S0, S)
+    ).

  set_ordlist.intersect_list(Sets) =
-	set_ordlist.power_intersect(Sets).
+    set_ordlist.power_intersect(Sets).

  %--------------------------------------------------------------------------%

  set_ordlist.difference([], _, []).
-set_ordlist.difference([X|Xs], [], [X|Xs]).
-set_ordlist.difference([X|Xs], [Y|Ys], Set) :-
-	compare(R, X, Y),
-	(
-		R = (<),
-		set_ordlist.difference(Xs, [Y|Ys], Set0),
-		Set = [X|Set0]
-	;
-		R = (=),
-		set_ordlist.difference(Xs, Ys, Set)
-	;
-		R = (>),
-		set_ordlist.difference([X|Xs], Ys, Set)
-	).
+set_ordlist.difference([X | Xs], [], [X | Xs]).
+set_ordlist.difference([X | Xs], [Y | Ys], Set) :-
+    compare(R, X, Y),
+    (
+        R = (<),
+        set_ordlist.difference(Xs, [Y | Ys], Set0),
+        Set = [X | Set0]
+    ;
+        R = (=),
+        set_ordlist.difference(Xs, Ys, Set)
+    ;
+        R = (>),
+        set_ordlist.difference([X | Xs], Ys, Set)
+    ).

  %--------------------------------------------------------------------------%

  set_ordlist.count(Set, Count) :-
-	list.length(Set, Count).
+    list.length(Set, Count).

  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%
  % Ralph Becket <rwab1 at cam.sri.com> 24/04/99
-%	Function forms added.
+%   Function forms added.

  set_ordlist.list_to_set(Xs) = S :-
-	set_ordlist.list_to_set(Xs, S).
+    set_ordlist.list_to_set(Xs, S).

  set_ordlist.sorted_list_to_set(Xs) = S :-
-	set_ordlist.sorted_list_to_set(Xs, S).
+    set_ordlist.sorted_list_to_set(Xs, S).

  set_ordlist.to_sorted_list(S) = Xs :-
-	set_ordlist.to_sorted_list(S, Xs).
+    set_ordlist.to_sorted_list(S, Xs).

  set_ordlist.init = S :-
-	set_ordlist.init(S).
+    set_ordlist.init(S).

  set_ordlist.make_singleton_set(T) = S :-
-	set_ordlist.singleton_set(S, T).
+    set_ordlist.singleton_set(S, T).

  set_ordlist.insert(S1, T) = S2 :-
-	set_ordlist.insert(S1, T, S2).
+    set_ordlist.insert(S1, T, S2).

  set_ordlist.insert_list(S1, Xs) = S2 :-
-	set_ordlist.insert_list(S1, Xs, S2).
+    set_ordlist.insert_list(S1, Xs, S2).

  set_ordlist.delete(S1, T) = S2 :-
-	set_ordlist.delete(S1, T, S2).
+    set_ordlist.delete(S1, T, S2).

  set_ordlist.delete_list(S1, Xs) = S2 :-
-	set_ordlist.delete_list(S1, Xs, S2).
+    set_ordlist.delete_list(S1, Xs, S2).

  set_ordlist.union(S1, S2) = S3 :-
-	set_ordlist.union(S1, S2, S3).
+    set_ordlist.union(S1, S2, S3).

  set_ordlist.power_union(SS) = S :-
-	set_ordlist.power_union(SS, S).
+    set_ordlist.power_union(SS, S).

  set_ordlist.intersect(S1, S2) = S3 :-
-	set_ordlist.intersect(S1, S2, S3).
+    set_ordlist.intersect(S1, S2, S3).

  set_ordlist.power_intersect(SS) = S :-
-	set_ordlist.power_intersect(SS, S).
+    set_ordlist.power_intersect(SS, S).

  set_ordlist.difference(S1, S2) = S3 :-
-	set_ordlist.difference(S1, S2, S3).
+    set_ordlist.difference(S1, S2, S3).

  set_ordlist.count(S) = N :-
-	set_ordlist.count(S, N).
+    set_ordlist.count(S, N).

  set_ordlist.map(F, S1) = S2 :-
-	S2 = set_ordlist.list_to_set(list.map(F,
-			set_ordlist.to_sorted_list(S1))).
+    S2 = set_ordlist.list_to_set(list.map(F,
+            set_ordlist.to_sorted_list(S1))).

  set_ordlist.filter_map(PF, S1) = S2 :-
-	S2 = set_ordlist.list_to_set(list.filter_map(PF,
-			set_ordlist.to_sorted_list(S1))).
+    S2 = set_ordlist.list_to_set(list.filter_map(PF,
+            set_ordlist.to_sorted_list(S1))).

  set_ordlist.fold(F, S, A) = B :-
-	B = list.foldl(F, set_ordlist.to_sorted_list(S), A).
+    B = list.foldl(F, set_ordlist.to_sorted_list(S), A).

-	% The calls to reverse allow us to make set_ordlist.divide_2 tail
-	% recursive. This costs us a higher constant factor, but allows
-	% set_ordlist.divide to work in constant stack space.
+    % The calls to reverse allow us to make set_ordlist.divide_2 tail
+    % recursive. This costs us a higher constant factor, but allows
+    % set_ordlist.divide to work in constant stack space.
  set_ordlist.divide(Pred, Set, TruePart, FalsePart) :-
-	set_ordlist.divide_2(Pred, Set, [], RevTruePart, [], RevFalsePart),
-	list.reverse(RevTruePart, TruePart),
-	list.reverse(RevFalsePart, FalsePart).
+    set_ordlist.divide_2(Pred, Set, [], RevTruePart, [], RevFalsePart),
+    list.reverse(RevTruePart, TruePart),
+    list.reverse(RevFalsePart, FalsePart).

  :- pred set_ordlist.divide_2(pred(T)::in(pred(in) is semidet),
-	set_ordlist(T)::in,
-	set_ordlist(T)::in, set_ordlist(T)::out,
-	set_ordlist(T)::in, set_ordlist(T)::out) is det.
+    set_ordlist(T)::in,
+    set_ordlist(T)::in, set_ordlist(T)::out,
+    set_ordlist(T)::in, set_ordlist(T)::out) is det.

  set_ordlist.divide_2(_Pred, [], RevTrue, RevTrue, RevFalse, RevFalse).
  set_ordlist.divide_2(Pred, [H | T], RevTrue0, RevTrue, RevFalse0, RevFalse) :-
-	( call(Pred, H) ->
-		RevTrue1 = [H | RevTrue0],
-		RevFalse1 = RevFalse0
-	;
-		RevTrue1 = RevTrue0,
-		RevFalse1 = [H | RevFalse0]
-	),
-	set_ordlist.divide_2(Pred, T, RevTrue1, RevTrue, RevFalse1, RevFalse).
+    ( Pred(H) ->
+        RevTrue1 = [H | RevTrue0],
+        RevFalse1 = RevFalse0
+    ;
+        RevTrue1 = RevTrue0,
+        RevFalse1 = [H | RevFalse0]
+    ),
+    set_ordlist.divide_2(Pred, T, RevTrue1, RevTrue, RevFalse1, RevFalse).

  set_ordlist.divide_by_set(DivideBySet, Set, TruePart, FalsePart) :-
-	set_ordlist.divide_by_set_2(DivideBySet, Set,
-		[], RevTruePart, [], RevFalsePart),
-	list.reverse(RevTruePart, TruePart),
-	list.reverse(RevFalsePart, FalsePart).
+    set_ordlist.divide_by_set_2(DivideBySet, Set,
+        [], RevTruePart, [], RevFalsePart),
+    list.reverse(RevTruePart, TruePart),
+    list.reverse(RevFalsePart, FalsePart).

  :- pred set_ordlist.divide_by_set_2(set_ordlist(T1)::in,
-	set_ordlist(T1)::in,
-	set_ordlist(T1)::in, set_ordlist(T1)::out,
-	set_ordlist(T1)::in, set_ordlist(T1)::out) is det.
+    set_ordlist(T1)::in,
+    set_ordlist(T1)::in, set_ordlist(T1)::out,
+    set_ordlist(T1)::in, set_ordlist(T1)::out) is det.

  set_ordlist.divide_by_set_2([], [], !RevTrue, !RevFalse).
  set_ordlist.divide_by_set_2([], [H | T], !RevTrue, !RevFalse) :-
-	list.append(list.reverse([H | T]), !RevFalse).
+    list.append(list.reverse([H | T]), !RevFalse).
  set_ordlist.divide_by_set_2([_ | _], [], !RevTrue, !RevFalse).
  set_ordlist.divide_by_set_2([Div | Divs], [H | T], !RevTrue, !RevFalse) :-
-	compare(R, Div, H),
-	(
-		R = (=),
-		!:RevTrue = [H | !.RevTrue],
-		set_ordlist.divide_by_set_2(Divs, T, !RevTrue, !RevFalse)
-	;
-		R = (<),
-		set_ordlist.divide_by_set_2(Divs, [H | T],
-			!RevTrue, !RevFalse)
-	;
-		R = (>),
-		!:RevFalse = [H | !.RevFalse],
-		set_ordlist.divide_by_set_2([Div | Divs], T,
-			!RevTrue, !RevFalse)
-	).
+    compare(R, Div, H),
+    (
+        R = (=),
+        !:RevTrue = [H | !.RevTrue],
+        set_ordlist.divide_by_set_2(Divs, T, !RevTrue, !RevFalse)
+    ;
+        R = (<),
+        set_ordlist.divide_by_set_2(Divs, [H | T],
+            !RevTrue, !RevFalse)
+    ;
+        R = (>),
+        !:RevFalse = [H | !.RevFalse],
+        set_ordlist.divide_by_set_2([Div | Divs], T,
+            !RevTrue, !RevFalse)
+    ).
Index: library/set_tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_tree234.m,v
retrieving revision 1.9
diff -u -r1.9 set_tree234.m
--- library/set_tree234.m	1 Oct 2006 04:14:54 -0000	1.9
+++ library/set_tree234.m	20 Oct 2006 14:57:53 -0000
@@ -21,6 +21,8 @@
  :- import_module bool.
  :- import_module list.

+%--------------------------------------------------------------------------%
+
  :- type set_tree234(_T).

      % `set_tree234.init = Set' is true iff `Set' is an empty set.
@@ -1889,21 +1891,21 @@
  set_tree234.fold(_Pred, empty, !A).
  set_tree234.fold(Pred, two(E, T0, T1), !A) :-
      set_tree234.fold(Pred, T0, !A),
-    call(Pred, E, !A),
+    Pred(E, !A),
      set_tree234.fold(Pred, T1, !A).
  set_tree234.fold(Pred, three(E0, E1, T0, T1, T2), !A) :-
      set_tree234.fold(Pred, T0, !A),
-    call(Pred, E0, !A),
+    Pred(E0, !A),
      set_tree234.fold(Pred, T1, !A),
-    call(Pred, E1, !A),
+    Pred(E1, !A),
      set_tree234.fold(Pred, T2, !A).
  set_tree234.fold(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A) :-
      set_tree234.fold(Pred, T0, !A),
-    call(Pred, E0, !A),
+    Pred(E0, !A),
      set_tree234.fold(Pred, T1, !A),
-    call(Pred, E1, !A),
+    Pred(E1, !A),
      set_tree234.fold(Pred, T2, !A),
-    call(Pred, E2, !A),
+    Pred(E2, !A),
      set_tree234.fold(Pred, T3, !A).

  set_tree234.fold(_Func, empty, A) = A.
@@ -1929,21 +1931,21 @@
  set_tree234.fold2(_Pred, empty, !A, !B).
  set_tree234.fold2(Pred, two(E, T0, T1), !A, !B) :-
      set_tree234.fold2(Pred, T0, !A, !B),
-    call(Pred, E, !A, !B),
+    Pred(E, !A, !B),
      set_tree234.fold2(Pred, T1, !A, !B).
  set_tree234.fold2(Pred, three(E0, E1, T0, T1, T2), !A, !B) :-
      set_tree234.fold2(Pred, T0, !A, !B),
-    call(Pred, E0, !A, !B),
+    Pred(E0, !A, !B),
      set_tree234.fold2(Pred, T1, !A, !B),
-    call(Pred, E1, !A, !B),
+    Pred(E1, !A, !B),
      set_tree234.fold2(Pred, T2, !A, !B).
  set_tree234.fold2(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B) :-
      set_tree234.fold2(Pred, T0, !A, !B),
-    call(Pred, E0, !A, !B),
+    Pred(E0, !A, !B),
      set_tree234.fold2(Pred, T1, !A, !B),
-    call(Pred, E1, !A, !B),
+    Pred(E1, !A, !B),
      set_tree234.fold2(Pred, T2, !A, !B),
-    call(Pred, E2, !A, !B),
+    Pred(E2, !A, !B),
      set_tree234.fold2(Pred, T3, !A, !B).

  %------------------------------------------------------------------------------%
@@ -1959,28 +1961,28 @@
  set_tree234.map_pred(Pred, Tin, !List) :-
      Tin = two(E0, T0, T1),
      set_tree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_tree234.map_pred(Pred, T1, !List).
  set_tree234.map_pred(Pred, Tin, !List) :-
      Tin = three(E0, E1, T0, T1, T2),
      set_tree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_tree234.map_pred(Pred, T1, !List),
-    call(Pred, E1, N1),
+    Pred(E1, N1),
      !:List = [N1 | !.List],
      set_tree234.map_pred(Pred, T2, !List).
  set_tree234.map_pred(Pred, Tin, !List) :-
      Tin = four(E0, E1, E2, T0, T1, T2, T3),
      set_tree234.map_pred(Pred, T0, !List),
-    call(Pred, E0, N0),
+    Pred(E0, N0),
      !:List = [N0 | !.List],
      set_tree234.map_pred(Pred, T1, !List),
-    call(Pred, E1, N1),
+    Pred(E1, N1),
      !:List = [N1 | !.List],
      set_tree234.map_pred(Pred, T2, !List),
-    call(Pred, E2, N2),
+    Pred(E2, N2),
      !:List = [N2 | !.List],
      set_tree234.map_pred(Pred, T3, !List).

Index: library/set_unordlist.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_unordlist.m,v
retrieving revision 1.27
diff -u -r1.27 set_unordlist.m
--- library/set_unordlist.m	19 Apr 2006 05:17:56 -0000	1.27
+++ library/set_unordlist.m	20 Oct 2006 12:58:03 -0000
@@ -1,4 +1,6 @@
  %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
  % Copyright (C) 1995-1997,1999-2002, 2004-2006 The University of Melbourne.
  % This file may only be copied under the terms of the GNU Library General
  % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -24,222 +26,222 @@

  :- type set_unordlist(_T).

-	% `set_unordlist.list_to_set(List, Set)' is true iff `Set' is the set
-	% containing only the members of `List'.
-	%
+    % `set_unordlist.list_to_set(List, Set)' is true iff `Set' is the set
+    % containing only the members of `List'.
+    %
  :- pred set_unordlist.list_to_set(list(T)::in, set_unordlist(T)::out) is det.
  :- func set_unordlist.list_to_set(list(T)) = set_unordlist(T).

-	% A synonym for set_unordlist.list_to_set/1.
-	%
+    % A synonym for set_unordlist.list_to_set/1.
+    %
  :- func set_unordlist.from_list(list(T)) = set_unordlist(T).

-	% `set_unordlist.sorted_list_to_set(List, Set)' is true iff `Set' is
-	% the set containing only the members of `List'.  `List' must be sorted.
-	%
+    % `set_unordlist.sorted_list_to_set(List, Set)' is true iff `Set' is
+    % the set containing only the members of `List'.  `List' must be sorted.
+    %
  :- pred set_unordlist.sorted_list_to_set(list(T)::in, set_unordlist(T)::out)
-	is det.
+    is det.
  :- func set_unordlist.sorted_list_to_set(list(T)) = set_unordlist(T).

-	% A synonym for set_unordlist.sorted_list_to_set/1.
-	%
+    % A synonym for set_unordlist.sorted_list_to_set/1.
+    %
  :- func set_unordlist.from_sorted_list(list(T)) = set_unordlist(T).

-	% `set_unordlist.to_sorted_list(Set, List)' is true iff `List' is the
-	% list of all the members of `Set', in sorted order.
-	%
+    % `set_unordlist.to_sorted_list(Set, List)' is true iff `List' is the
+    % list of all the members of `Set', in sorted order.
+    %
  :- pred set_unordlist.to_sorted_list(set_unordlist(T)::in, list(T)::out)
-	is det.
+    is det.
  :- func set_unordlist.to_sorted_list(set_unordlist(T)) = list(T).

-	% `set_unordlist.init(Set)' is true iff `Set' is an empty set.
-	%
+    % `set_unordlist.init(Set)' is true iff `Set' is an empty set.
+    %
  :- pred set_unordlist.init(set_unordlist(_T)::uo) is det.
  :- func set_unordlist.init = set_unordlist(T).

-	% `set_unordlist.singleton_set(Set, Elem)' is true iff `Set' is the set
-	% containing just the single element `Elem'.
-	%
+    % `set_unordlist.singleton_set(Set, Elem)' is true iff `Set' is the set
+    % containing just the single element `Elem'.
+    %
  :- pred set_unordlist.singleton_set(set_unordlist(T), T).
  :- mode set_unordlist.singleton_set(in, out) is semidet.
  :- mode set_unordlist.singleton_set(out, in) is det.

  :- func set_unordlist.make_singleton_set(T) = set_unordlist(T).

-	% `set_unordlist.equal(SetA, SetB)' is true iff
-	% `SetA' and `SetB' contain the same elements.
-	%
+    % `set_unordlist.equal(SetA, SetB)' is true iff
+    % `SetA' and `SetB' contain the same elements.
+    %
  :- pred set_unordlist.equal(set_unordlist(T)::in, set_unordlist(T)::in)
-	is semidet.
+    is semidet.

-	% `set_unordlist.empty(Set)' is true iff `Set' is an empty set.
-	%
+    % `set_unordlist.empty(Set)' is true iff `Set' is an empty set.
+    %
  :- pred set_unordlist.empty(set_unordlist(_T)::in) is semidet.

-	% `set_unordlist.subset(SetA, SetB)' is true iff `SetA' is a subset of
-	% `SetB'.
-	%
+    % `set_unordlist.subset(SetA, SetB)' is true iff `SetA' is a subset of
+    % `SetB'.
+    %
  :- pred set_unordlist.subset(set_unordlist(T)::in, set_unordlist(T)::in)
-	is semidet.
+    is semidet.

-	% `set_unordlist.superset(SetA, SetB)' is true iff `SetA' is a
-	% superset of `SetB'.
-	%
+    % `set_unordlist.superset(SetA, SetB)' is true iff `SetA' is a
+    % superset of `SetB'.
+    %
  :- pred set_unordlist.superset(set_unordlist(T)::in, set_unordlist(T)::in)
-	is semidet.
+    is semidet.

-	% `set_unordlist.member(X, Set)' is true iff `X' is a member of `Set'.
-	%
+    % `set_unordlist.member(X, Set)' is true iff `X' is a member of `Set'.
+    %
  :- pred set_unordlist.member(T, set_unordlist(T)).
  :- mode set_unordlist.member(in, in) is semidet.
  :- mode set_unordlist.member(out, in) is nondet.

-	% `set_unordlist.is_member(X, Set, Result)' returns
-	% `Result = yes' iff `X' is a member of `Set'.
-	%
+    % `set_unordlist.is_member(X, Set, Result)' returns
+    % `Result = yes' iff `X' is a member of `Set'.
+    %
  :- pred set_unordlist.is_member(T::in, set_unordlist(T)::in, bool::out)
-	is det.
+    is det.

-	% `set_unordlist.contains(Set, X)' is true iff
-	% `X' is a member of `Set'.
-	%
+    % `set_unordlist.contains(Set, X)' is true iff
+    % `X' is a member of `Set'.
+    %
  :- pred set_unordlist.contains(set_unordlist(T)::in, T::in) is semidet.

-	% `set_unordlist.insert(Set0, X, Set)' is true iff `Set' is the union
-	% of `Set0' and the set containing only `X'.
-	%
+    % `set_unordlist.insert(Set0, X, Set)' is true iff `Set' is the union
+    % of `Set0' and the set containing only `X'.
+    %
  :- pred set_unordlist.insert(set_unordlist(T), T, set_unordlist(T)).
  :- mode set_unordlist.insert(di, di, uo) is det.
  :- mode set_unordlist.insert(in, in, out) is det.

  :- func set_unordlist.insert(set_unordlist(T), T) = set_unordlist(T).

-	% `set_unordlist.insert_list(Set0, Xs, Set)' is true iff `Set' is the
-	% union of `Set0' and the set containing only the members of `Xs'.
-	%
+    % `set_unordlist.insert_list(Set0, Xs, Set)' is true iff `Set' is the
+    % union of `Set0' and the set containing only the members of `Xs'.
+    %
  :- pred set_unordlist.insert_list(set_unordlist(T)::in, list(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.insert_list(set_unordlist(T), list(T))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.delete(Set0, X, Set)' is true iff `Set' is the
-	% relative complement of `Set0' and the set containing only `X', i.e.
-	% if `Set' is the set which contains all the elements of `Set0'
-	% except `X'.
-	%
+    % `set_unordlist.delete(Set0, X, Set)' is true iff `Set' is the
+    % relative complement of `Set0' and the set containing only `X', i.e.
+    % if `Set' is the set which contains all the elements of `Set0'
+    % except `X'.
+    %
  :- pred set_unordlist.delete(set_unordlist(T), T, set_unordlist(T)).
  :- mode set_unordlist.delete(di, in, uo) is det.
  :- mode set_unordlist.delete(in, in, out) is det.

  :- func set_unordlist.delete(set_unordlist(T), T) = set_unordlist(T).

-	% `set_unordlist.delete_list(Set0, Xs, Set)' is true iff `Set' is the
-	% relative complement of `Set0' and the set containing only the members
-	% of `Xs'.
-	%
+    % `set_unordlist.delete_list(Set0, Xs, Set)' is true iff `Set' is the
+    % relative complement of `Set0' and the set containing only the members
+    % of `Xs'.
+    %
  :- pred set_unordlist.delete_list(set_unordlist(T)::in, list(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.delete_list(set_unordlist(T), list(T))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.remove(Set0, X, Set)' is true iff `Set0' contains `X',
-	% and `Set' is the relative complement of `Set0' and the set
-	% containing only `X', i.e.  if `Set' is the set which contains
-	% all the elements of `Set0' except `X'.
-	%
+    % `set_unordlist.remove(Set0, X, Set)' is true iff `Set0' contains `X',
+    % and `Set' is the relative complement of `Set0' and the set
+    % containing only `X', i.e.  if `Set' is the set which contains
+    % all the elements of `Set0' except `X'.
+    %
  :- pred set_unordlist.remove(set_unordlist(T)::in, T::in,
-	set_unordlist(T)::out) is semidet.
+    set_unordlist(T)::out) is semidet.

-	% `set_unordlist.remove_list(Set0, Xs, Set)' is true iff Xs does not
-	% contain any duplicates, `Set0' contains every member of `Xs',
-	% and `Set' is the relative complement of `Set0' and the set
-	% containing only the members of `Xs'.
-	%
+    % `set_unordlist.remove_list(Set0, Xs, Set)' is true iff Xs does not
+    % contain any duplicates, `Set0' contains every member of `Xs',
+    % and `Set' is the relative complement of `Set0' and the set
+    % containing only the members of `Xs'.
+    %
  :- pred set_unordlist.remove_list(set_unordlist(T)::in, list(T)::in,
-	set_unordlist(T)::out) is semidet.
+    set_unordlist(T)::out) is semidet.

-	% `set_unordlist.remove_least(Set0, X, Set)' is true iff `X' is the
-	% least element in `Set0', and `Set' is the set which contains all the
-	% elements of `Set0' except `X'.
-	%
+    % `set_unordlist.remove_least(Set0, X, Set)' is true iff `X' is the
+    % least element in `Set0', and `Set' is the set which contains all the
+    % elements of `Set0' except `X'.
+    %
  :- pred set_unordlist.remove_least(set_unordlist(T)::in, T::out,
-	set_unordlist(T)::out) is semidet.
+    set_unordlist(T)::out) is semidet.

-	% `set_unordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
-	% of `SetA' and `SetB'.  If the sets are known to be of different
-	% sizes, then for efficiency make `SetA' the larger of the two.
-	%
+    % `set_unordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
+    % of `SetA' and `SetB'.  If the sets are known to be of different
+    % sizes, then for efficiency make `SetA' the larger of the two.
+    %
  :- pred set_unordlist.union(set_unordlist(T)::in, set_unordlist(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.union(set_unordlist(T), set_unordlist(T))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.union_list(A) = B' is true iff `B' is the union of
-	% all the sets in `A'
-	%
+    % `set_unordlist.union_list(A) = B' is true iff `B' is the union of
+    % all the sets in `A'
+    %
  :- func set_unordlist.union_list(list(set_unordlist(T))) = set_unordlist(T).

-	% `set_unordlist.power_union(A, B)' is true iff `B' is the union of
-	% all the sets in `A'
-	%
+    % `set_unordlist.power_union(A, B)' is true iff `B' is the union of
+    % all the sets in `A'
+    %
  :- pred set_unordlist.power_union(set_unordlist(set_unordlist(T))::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.power_union(set_unordlist(set_unordlist(T)))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.intersect(SetA, SetB, Set)' is true iff `Set' is the
-	% intersection of `SetA' and `SetB'.
-	%
+    % `set_unordlist.intersect(SetA, SetB, Set)' is true iff `Set' is the
+    % intersection of `SetA' and `SetB'.
+    %
  :- pred set_unordlist.intersect(set_unordlist(T)::in, set_unordlist(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.intersect(set_unordlist(T), set_unordlist(T))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.power_intersect(A, B)' is true iff `B' is the
-	% intersection of all the sets in `A'
-	%
+    % `set_unordlist.power_intersect(A, B)' is true iff `B' is the
+    % intersection of all the sets in `A'
+    %
  :- pred set_unordlist.power_intersect(set_unordlist(set_unordlist(T))::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.power_intersect(set_unordlist(set_unordlist(T)))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.intersect_list(A, B)' is true iff `B' is the
-	% intersection of all the sets in `A'
-	%
+    % `set_unordlist.intersect_list(A, B)' is true iff `B' is the
+    % intersection of all the sets in `A'
+    %
  :- func set_unordlist.intersect_list(list(set_unordlist(T)))
-	= set_unordlist(T).
+    = set_unordlist(T).

-	% `set_unordlist.difference(SetA, SetB, Set)' is true iff `Set' is the
-	% set containing all the elements of `SetA' except those that
-	% occur in `SetB'
-	%
+    % `set_unordlist.difference(SetA, SetB, Set)' is true iff `Set' is the
+    % set containing all the elements of `SetA' except those that
+    % occur in `SetB'
+    %
  :- pred set_unordlist.difference(set_unordlist(T)::in, set_unordlist(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  :- func set_unordlist.difference(set_unordlist(T), set_unordlist(T))
-	= set_unordlist(T).
+    = set_unordlist(T).

  :- func set_unordlist.map(func(T1) = T2, set_unordlist(T1))
-	= set_unordlist(T2).
+    = set_unordlist(T2).

  :- func set_unordlist.filter_map(func(T1) = T2, set_unordlist(T1))
-	= set_unordlist(T2).
+    = set_unordlist(T2).
  :- mode set_unordlist.filter_map(func(in) = out is semidet, in) = out is det.

  :- func set_unordlist.fold(func(T1, T2) = T2, set_unordlist(T1), T2) = T2.

-	% set_unordlist.divide(Pred, Set, TruePart, FalsePart):
-	% TruePart consists of those elements of Set for which Pred succeeds;
-	% FalsePart consists of those elements of Set for which Pred fails.
-	%
+    % set_unordlist.divide(Pred, Set, TruePart, FalsePart):
+    % TruePart consists of those elements of Set for which Pred succeeds;
+    % FalsePart consists of those elements of Set for which Pred fails.
+    %
  :- pred set_unordlist.divide(pred(T1), set_unordlist(T1), set_unordlist(T1),
-	set_unordlist(T1)).
+    set_unordlist(T1)).
  :- mode set_unordlist.divide(pred(in) is semidet, in, out, out) is det.

  %--------------------------------------------------------------------------%
@@ -249,7 +251,7 @@

  %--------------------------------------------------------------------------%

-:- type set_unordlist(T) ==	  list(T).
+:- type set_unordlist(T) ==   list(T).

  set_unordlist.list_to_set(List, List).

@@ -260,199 +262,197 @@
  set_unordlist.from_sorted_list(List) = List.

  set_unordlist.to_sorted_list(Set, List) :-
-	list.sort_and_remove_dups(Set, List).
+    list.sort_and_remove_dups(Set, List).

  set_unordlist.insert_list(Set0, List, Set) :-
-	list.append(List, Set0, Set).
+    list.append(List, Set0, Set).

-set_unordlist.insert(S0, E, [E|S0]).
+set_unordlist.insert(S0, E, [E | S0]).

  set_unordlist.init([]).

  set_unordlist.singleton_set([X], X).

  set_unordlist.equal(SetA, SetB) :-
-	set_unordlist.subset(SetA, SetB),
-	set_unordlist.subset(SetB, SetA).
+    set_unordlist.subset(SetA, SetB),
+    set_unordlist.subset(SetB, SetA).

  set_unordlist.empty([]).

  set_unordlist.subset([], _).
-set_unordlist.subset([E|S0], S1) :-
-	set_unordlist.member(E, S1),
-	set_unordlist.subset(S0, S1).
+set_unordlist.subset([E | S0], S1) :-
+    set_unordlist.member(E, S1),
+    set_unordlist.subset(S0, S1).

  set_unordlist.superset(S0, S1) :-
-	set_unordlist.subset(S1, S0).
+    set_unordlist.subset(S1, S0).

  set_unordlist.member(E, S) :-
-	list.member(E, S).
+    list.member(E, S).

  set_unordlist.is_member(E, S, R) :-
-	( set_unordlist.member(E, S) ->
-		R = yes
-	;
-		R = no
-	).
+    ( set_unordlist.member(E, S) ->
+        R = yes
+    ;
+        R = no
+    ).

  set_unordlist.contains(S, E) :-
-	set_unordlist.member(E, S).
+    set_unordlist.member(E, S).

  set_unordlist.delete_list(S, [], S).
  set_unordlist.delete_list(S0, [X | Xs], S) :-
-	set_unordlist.delete(S0, X, S1),
-	set_unordlist.delete_list(S1, Xs, S).
+    set_unordlist.delete(S0, X, S1),
+    set_unordlist.delete_list(S1, Xs, S).

  set_unordlist.delete(S0, E, S) :-
-	list.delete_all(S0, E, S).
+    list.delete_all(S0, E, S).

  set_unordlist.remove_list(S, [], S).
  set_unordlist.remove_list(S0, [X | Xs], S) :-
-	set_unordlist.remove(S0, X, S1),
-	set_unordlist.remove_list(S1, Xs, S).
+    set_unordlist.remove(S0, X, S1),
+    set_unordlist.remove_list(S1, Xs, S).

  set_unordlist.remove(S0, E, S) :-
-	list.member(E, S0),
-	set_unordlist.delete(S0, E, S).
+    list.member(E, S0),
+    set_unordlist.delete(S0, E, S).

  set_unordlist.remove_least(Set0, E, Set) :-
-	Set0 = [_|_],	% fail early on an empty set
-	set_unordlist.to_sorted_list(Set0, [E|Set]).
+    Set0 = [_ | _],   % fail early on an empty set
+    set_unordlist.to_sorted_list(Set0, [E | Set]).

  set_unordlist.union(Set0, Set1, Set) :-
-	list.append(Set1, Set0, Set).
+    list.append(Set1, Set0, Set).

  set_unordlist.union_list(LS) = S :-
-	set_unordlist.power_union(LS, S).
+    set_unordlist.power_union(LS, S).

  set_unordlist.power_union(PS, S) :-
-	set_unordlist.init(S0),
-	set_unordlist.power_union_2(PS, S0, S1),
-	list.sort_and_remove_dups(S1, S).
+    set_unordlist.init(S0),
+    set_unordlist.power_union_2(PS, S0, S1),
+    list.sort_and_remove_dups(S1, S).

  :- pred set_unordlist.power_union_2(list(set_unordlist(T))::in,
-	set_unordlist(T)::in, set_unordlist(T)::out) is det.
+    set_unordlist(T)::in, set_unordlist(T)::out) is det.

-set_unordlist.power_union_2([], S, S).
-set_unordlist.power_union_2([T|Ts], S0, S) :-
-	set_unordlist.union(S0, T, S1),
-	set_unordlist.power_union_2(Ts, S1, S).
+set_unordlist.power_union_2([], !S).
+set_unordlist.power_union_2([T | Ts], !S) :-
+    set_unordlist.union(!.S, T, !:S),
+    set_unordlist.power_union_2(Ts, !S).

  set_unordlist.intersect(S0, S1, S) :-
-	set_unordlist.intersect_2(S0, S1, [], S).
+    set_unordlist.intersect_2(S0, S1, [], S).

  :- pred set_unordlist.intersect_2(set_unordlist(T)::in, set_unordlist(T)::in,
-	set_unordlist(T)::in, set_unordlist(T)::out) is det.
+    set_unordlist(T)::in, set_unordlist(T)::out) is det.

  set_unordlist.intersect_2([], _, S, S).
-set_unordlist.intersect_2([E|S0], S1, S2, S) :-
-	( list.member(E, S1) ->
-		S3 = [E|S2]
-	;
-		S3 = S2
-	),
-	set_unordlist.intersect_2(S0, S1, S3, S).
+set_unordlist.intersect_2([E | S0], S1, S2, S) :-
+    ( list.member(E, S1) ->
+        S3 = [E | S2]
+    ;
+        S3 = S2
+    ),
+    set_unordlist.intersect_2(S0, S1, S3, S).

  set_unordlist.power_intersect([], []).
-set_unordlist.power_intersect([S0|Ss], S) :-
-	( Ss = [] ->
-		S = S0
-	;
-		set_unordlist.power_intersect(Ss, S1),
-		set_unordlist.intersect(S1, S0, S)
-	).
+set_unordlist.power_intersect([S0 | Ss], S) :-
+    (
+        Ss = [],
+        S = S0
+    ;
+        Ss = [_ | _],
+        set_unordlist.power_intersect(Ss, S1),
+        set_unordlist.intersect(S1, S0, S)
+    ).

  set_unordlist.intersect_list(Sets) =
-	set_unordlist.power_intersect(Sets).
+    set_unordlist.power_intersect(Sets).

  %--------------------------------------------------------------------------%

  set_unordlist.difference(A, B, C) :-
-	set_unordlist.difference_2(B, A, C).
+    set_unordlist.difference_2(B, A, C).

  :- pred set_unordlist.difference_2(set_unordlist(T)::in, set_unordlist(T)::in,
-	set_unordlist(T)::out) is det.
+    set_unordlist(T)::out) is det.

  set_unordlist.difference_2([], C, C).
-set_unordlist.difference_2([E|Es], A, C) :-
-	set_unordlist.delete(A, E, B),
-	set_unordlist.difference_2(Es, B, C).
+set_unordlist.difference_2([E | Es], A, C) :-
+    set_unordlist.delete(A, E, B),
+    set_unordlist.difference_2(Es, B, C).

  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%
  % Ralph Becket <rwab1 at cam.sri.com> 24/04/99
-%	Function forms added.
+%   Function forms added.

  set_unordlist.list_to_set(Xs) = S :-
-	set_unordlist.list_to_set(Xs, S).
+    set_unordlist.list_to_set(Xs, S).

  set_unordlist.sorted_list_to_set(Xs) = S :-
-	set_unordlist.sorted_list_to_set(Xs, S).
+    set_unordlist.sorted_list_to_set(Xs, S).

  set_unordlist.to_sorted_list(S) = Xs :-
-	set_unordlist.to_sorted_list(S, Xs).
+    set_unordlist.to_sorted_list(S, Xs).

  set_unordlist.init = S :-
-	set_unordlist.init(S).
+    set_unordlist.init(S).

  set_unordlist.make_singleton_set(T) = S :-
-	set_unordlist.singleton_set(S, T).
+    set_unordlist.singleton_set(S, T).

  set_unordlist.insert(S1, T) = S2 :-
-	set_unordlist.insert(S1, T, S2).
+    set_unordlist.insert(S1, T, S2).

  set_unordlist.insert_list(S1, Xs) = S2 :-
-	set_unordlist.insert_list(S1, Xs, S2).
+    set_unordlist.insert_list(S1, Xs, S2).

  set_unordlist.delete(S1, T) = S2 :-
-	set_unordlist.delete(S1, T, S2).
+    set_unordlist.delete(S1, T, S2).

  set_unordlist.delete_list(S1, Xs) = S2 :-
-	set_unordlist.delete_list(S1, Xs, S2).
+    set_unordlist.delete_list(S1, Xs, S2).

  set_unordlist.union(S1, S2) = S3 :-
-	set_unordlist.union(S1, S2, S3).
+    set_unordlist.union(S1, S2, S3).

  set_unordlist.power_union(SS) = S :-
-	set_unordlist.power_union(SS, S).
+    set_unordlist.power_union(SS, S).

  set_unordlist.intersect(S1, S2) = S3 :-
-	set_unordlist.intersect(S1, S2, S3).
+    set_unordlist.intersect(S1, S2, S3).

  set_unordlist.power_intersect(SS) = S :-
-	set_unordlist.power_intersect(SS, S).
+    set_unordlist.power_intersect(SS, S).

  set_unordlist.difference(S1, S2) = S3 :-
-	set_unordlist.difference(S1, S2, S3).
+    set_unordlist.difference(S1, S2, S3).

  set_unordlist.map(F, S1) = S2 :-
-	S2 = set_unordlist.list_to_set(list.map(F,
-		set_unordlist.to_sorted_list(S1))).
+    S2 = set_unordlist.list_to_set(list.map(F,
+        set_unordlist.to_sorted_list(S1))).

  set_unordlist.filter_map(PF, S1) = S2 :-
-	S2 = set_unordlist.list_to_set(list.filter_map(PF,
-		set_unordlist.to_sorted_list(S1))).
+    S2 = set_unordlist.list_to_set(list.filter_map(PF,
+        set_unordlist.to_sorted_list(S1))).

  set_unordlist.fold(F, S, A) = B :-
-	B = list.foldl(F, set_unordlist.to_sorted_list(S), A).
+    B = list.foldl(F, set_unordlist.to_sorted_list(S), A).

  set_unordlist.divide(Pred, Set, RevTruePart, RevFalsePart) :-
-	set_unordlist.divide_2(Pred, Set, [], RevTruePart, [], RevFalsePart).
+    set_unordlist.divide_2(Pred, Set, [], RevTruePart, [], RevFalsePart).

  :- pred set_unordlist.divide_2(pred(T1)::in(pred(in) is semidet),
-	set_unordlist(T1)::in,
-	set_unordlist(T1)::in, set_unordlist(T1)::out,
-	set_unordlist(T1)::in, set_unordlist(T1)::out) is det.
-
-set_unordlist.divide_2(_Pred, [], RevTrue, RevTrue, RevFalse, RevFalse).
-set_unordlist.divide_2(Pred, [H | T],
-		RevTrue0, RevTrue, RevFalse0, RevFalse) :-
-	( call(Pred, H) ->
-		RevTrue1 = [H | RevTrue0],
-		RevFalse1 = RevFalse0
-	;
-		RevTrue1 = RevTrue0,
-		RevFalse1 = [H | RevFalse0]
-	),
-	set_unordlist.divide_2(Pred, T,
-		RevTrue1, RevTrue, RevFalse1, RevFalse).
+    set_unordlist(T1)::in,
+    set_unordlist(T1)::in, set_unordlist(T1)::out,
+    set_unordlist(T1)::in, set_unordlist(T1)::out) is det.
+
+set_unordlist.divide_2(_Pred, [], !RevTrue, !RevFalse).
+set_unordlist.divide_2(Pred, [H | T], !RevTrue, !RevFalse) :-
+    ( Pred(H) ->
+        !:RevTrue = [H | !.RevTrue]
+    ;
+        !:RevFalse = [H | !.RevFalse]
+    ),
+    set_unordlist.divide_2(Pred, T, !RevTrue, !RevFalse).
Index: library/solutions.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/solutions.m,v
retrieving revision 1.5
diff -u -r1.5 solutions.m
--- library/solutions.m	10 Jul 2006 04:40:52 -0000	1.5
+++ library/solutions.m	20 Oct 2006 11:53:49 -0000
@@ -180,9 +180,11 @@
      builtin_solutions(Pred, UnsortedList),
      list.sort_and_remove_dups(UnsortedList, List).

-solutions(P) = S :- solutions(P, S).
+solutions(P) = S :-
+    solutions(P, S).

-solutions_set(P) = S :- solutions_set(P, S).
+solutions_set(P) = S :-
+    solutions_set(P, S).

  solutions_set(Pred, Set) :-
      builtin_solutions(Pred, List),
@@ -211,10 +213,8 @@
  %-----------------------------------------------------------------------------%

  :- pred builtin_solutions(pred(T), list(T)).
-:- mode builtin_solutions(pred(out) is multi, out)
-    is det. /* really cc_multi */
-:- mode builtin_solutions(pred(out) is nondet, out)
-    is det. /* really cc_multi */
+:- mode builtin_solutions(pred(out) is multi, out) is det.  % really cc_multi
+:- mode builtin_solutions(pred(out) is nondet, out) is det. % really cc_multi

  builtin_solutions(Generator, UnsortedList) :-
      builtin_aggregate(Generator, list.cons, [], UnsortedList).
Index: library/sparse_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.29
diff -u -r1.29 sparse_bitset.m
--- library/sparse_bitset.m	19 Apr 2006 05:17:56 -0000	1.29
+++ library/sparse_bitset.m	20 Oct 2006 13:31:13 -0000
@@ -56,9 +56,7 @@
      % Return an empty set.
      %
  :- func init = sparse_bitset(T).
-
-:- pred init(sparse_bitset(T)).
-:- mode init(out) is det.
+:- pred init(sparse_bitset(T)::out) is det.

  :- pred empty(sparse_bitset(T)).
  :- mode empty(in) is semidet.
@@ -921,7 +919,7 @@

  %-----------------------------------------------------------------------------%

-:- pragma promise_pure(member/2).
+:- pragma promise_equivalent_clauses(member/2).

  member(Elem::in, Set::in) :-
      contains(Set, Elem).
Index: library/store.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.60
diff -u -r1.60 store.m
--- library/store.m	20 Oct 2006 06:44:41 -0000	1.60
+++ library/store.m	20 Oct 2006 13:24:32 -0000
@@ -30,14 +30,17 @@

  :- module store.
  :- interface.
+
  :- import_module io.

-% Stores and keys are indexed by a type S of typeclass store(S) that
-% is used to distinguish between different stores.  By using an
-% existential type declaration for store.new (see below), we use the
-% type system to ensure at compile time that you never attempt to use
-% a key from one store to access a different store.
+%-----------------------------------------------------------------------------%

+    % Stores and keys are indexed by a type S of typeclass store(S) that
+    % is used to distinguish between different stores.  By using an
+    % existential type declaration for store.new (see below), we use the
+    % type system to ensure at compile time that you never attempt to use
+    % a key from one store to access a different store.
+    %
  :- typeclass store(S).
  :- type store(S).

Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.250
diff -u -r1.250 string.m
--- library/string.m	20 Sep 2006 09:42:25 -0000	1.250
+++ library/string.m	20 Oct 2006 15:16:19 -0000
@@ -33,16 +33,14 @@
      % Determine the length of a string.
      % An empty string has length zero.
      %
-:- func string.length(string) = int.
-:- mode string.length(in) = uo is det.
+:- func string.length(string::in) = (int::uo) is det.
  :- pred string.length(string, int).
  :- mode string.length(in, uo) is det.
  :- mode string.length(ui, uo) is det.

      % Append two strings together.
      %
-:- func string.append(string, string) = string.
-:- mode string.append(in, in) = uo is det.
+:- func string.append(string::in, string::in) = (string::uo) is det.

  :- pred string.append(string, string, string).
  :- mode string.append(in, in, in) is semidet.  % implied
@@ -103,8 +101,7 @@
      % - `include_details_cc' will show the structure of any non-canonical
      %   subterms, but can only be called from a committed choice context.
      %
-:- pred string.string_ops_noncanon(deconstruct.noncanon_handling, ops.table,
-    T, string).
+:- pred string.string_ops_noncanon(noncanon_handling, ops.table, T, string).
  :- mode string.string_ops_noncanon(in(do_not_allow), in, in, out) is det.
  :- mode string.string_ops_noncanon(in(canonicalize), in, in, out) is det.
  :- mode string.string_ops_noncanon(in(include_details_cc), in, in, out)
@@ -114,8 +111,7 @@
      % string.char_to_string(Char, String).
      % Converts a character (single-character atom) to a string or vice versa.
      %
-:- func string.char_to_string(char) = string.
-:- mode string.char_to_string(in) = uo is det.
+:- func string.char_to_string(char::in) = (string::uo) is det.
  :- pred string.char_to_string(char, string).
  :- mode string.char_to_string(in, uo) is det.
  :- mode string.char_to_string(out, in) is semidet.
@@ -126,10 +122,8 @@

      % Convert an integer to a string.
      %
-:- func string.int_to_string(int) = string.
-:- mode string.int_to_string(in) = uo is det.
-:- pred string.int_to_string(int, string).
-:- mode string.int_to_string(in, uo) is det.
+:- func string.int_to_string(int::in) = (string::uo) is det.
+:- pred string.int_to_string(int::in, string::uo) is det.

      % A synonym for string.int_to_string/1.
      %
@@ -137,17 +131,14 @@

      % Convert an integer to a string with commas as thousand separators.
      %
-:- func string.int_to_string_thousands(int) = string.
-:- mode string.int_to_string_thousands(in) = uo is det.
+:- func string.int_to_string_thousands(int::in) = (string::uo) is det.

      % string.int_to_base_string(Int, Base, String):
      % Convert an integer to a string in a given Base.
      % An exception is thrown if Base is not between 2 and 36.
      %
-:- func string.int_to_base_string(int, int) = string.
-:- mode string.int_to_base_string(in, in) = uo is det.
-:- pred string.int_to_base_string(int, int, string).
-:- mode string.int_to_base_string(in, in, uo) is det.
+:- func string.int_to_base_string(int::in, int::in) = (string::uo) is det.
+:- pred string.int_to_base_string(int::in, int::in, string::uo) is det.

      % string.int_to_base_string_group(Int, Base, GroupLength, Separator,
      %   String):
@@ -168,10 +159,8 @@
      % The precision chosen from this range will be such to allow a successful
      % decimal -> binary conversion of the float.
      %
-:- func string.float_to_string(float) = string.
-:- mode string.float_to_string(in) = uo is det.
-:- pred string.float_to_string(float, string).
-:- mode string.float_to_string(in, uo) is det.
+:- func string.float_to_string(float::in) = (string::uo) is det.
+:- pred string.float_to_string(float::in, string::uo) is det.

      % A synonym for string.float_to_string/1.
      %
@@ -215,23 +204,21 @@
      % string.replace_all replaces any occurrences of Search in String0
      % with Replace to give String.
      %
-:- func string.replace_all(string, string, string) = string.
-:- mode string.replace_all(in, in, in) = uo is det.
-:- pred string.replace_all(string, string, string, string).
-:- mode string.replace_all(in, in, in, uo) is det.
+:- func string.replace_all(string::in, string::in, string::in) = (string::uo)
+    is det.
+:- pred string.replace_all(string::in, string::in, string::in, string::uo)
+    is det.

      % Converts a string to lowercase.
      %
-:- func string.to_lower(string) = string.
-:- mode string.to_lower(in) = uo is det.
+:- func string.to_lower(string::in) = (string::uo) is det.
  :- pred string.to_lower(string, string).
  :- mode string.to_lower(in, uo) is det.
  :- mode string.to_lower(in, in) is semidet.        % implied

      % Converts a string to uppercase.
      %
-:- func string.to_upper(string) = string.
-:- mode string.to_upper(in) = uo is det.
+:- func string.to_upper(string::in) = (string::uo) is det.
  :- pred string.to_upper(string, string).
  :- mode string.to_upper(in, uo) is det.
  :- mode string.to_upper(in, in) is semidet.        % implied
@@ -255,8 +242,7 @@

      % Convert a list of characters to a string.
      %
-:- func string.from_char_list(list(char)) = string.
-:- mode string.from_char_list(in) = uo is det.
+:- func string.from_char_list(list(char)::in) = (string::uo) is det.
  :- pred string.from_char_list(list(char), string).
  :- mode string.from_char_list(in, uo) is det.
  :- mode string.from_char_list(out, in) is det.
@@ -264,10 +250,8 @@
      % Same as string.from_char_list, except that it reverses the order
      % of the characters.
      %
-:- func string.from_rev_char_list(list(char)) = string.
-:- mode string.from_rev_char_list(in) = uo is det.
-:- pred string.from_rev_char_list(list(char), string).
-:- mode string.from_rev_char_list(in, uo) is det.
+:- func string.from_rev_char_list(list(char)::in) = (string::uo) is det.
+:- pred string.from_rev_char_list(list(char)::in, string::uo) is det.

      % Converts a signed base 10 string to an int; throws an exception
      % if the string argument does not match the regexp [+-]?[0-9]+
@@ -609,10 +593,8 @@
      % If `Count' is out of the range [0, length of `String' - `Start'],
      % it is treated as if it were the nearest end-point of that range.)
      %
-:- func string.substring(string, int, int) = string.
-:- mode string.substring(in, in, in) = uo is det.
-:- pred string.substring(string, int, int, string).
-:- mode string.substring(in, in, in, uo) is det.
+:- func string.substring(string::in, int::in, int::in) = (string::uo) is det.
+:- pred string.substring(string::in, int::in, int::in, string::uo) is det.

      % string.unsafe_substring(String, Start, Count, Substring):
      % `Substring' is first the `Count' characters in what would remain
@@ -624,10 +606,10 @@
      % whereas string.substring may take time proportional to the length
      %% of the whole string.
      %
-:- func string.unsafe_substring(string, int, int) = string.
-:- mode string.unsafe_substring(in, in, in) = uo is det.
-:- pred string.unsafe_substring(string, int, int, string).
-:- mode string.unsafe_substring(in, in, in, uo) is det.
+:- func string.unsafe_substring(string::in, int::in, int::in) = (string::uo)
+    is det.
+:- pred string.unsafe_substring(string::in, int::in, int::in, string::uo)
+    is det.

      % Append a list of strings together.
      %
@@ -978,7 +960,7 @@
      string.to_char_list(C, LC),
      char_list_remove_suffix(LA, LB, LC).

-:- pragma promise_pure(string.prefix/2).
+:- pragma promise_equivalent_clauses(string.prefix/2).

  string.prefix(String::in, Prefix::in) :-
      Len    = length(String),
@@ -1009,7 +991,7 @@
      PreLen < Len,
      prefix_2_ioii(String, Prefix, PreLen + 1, Len).

-:- pragma promise_pure(string.suffix/2).
+:- pragma promise_equivalent_clauses(string.suffix/2).

  string.suffix(String::in, Suffix::in) :-
      Len    = length(String),
@@ -1227,7 +1209,7 @@
      Str[size] = '\\0';
  }").

-:- pragma promise_pure(string.to_char_list/2).
+:- pragma promise_equivalent_clauses(string.to_char_list/2).

  string.to_char_list(Str::in, CharList::out) :-
      string.to_char_list_2(Str, 0, CharList).
@@ -3477,7 +3459,7 @@
      Length = Str.length();
  ").

-:- pragma promise_pure(string.length/2).
+:- pragma promise_equivalent_clauses(string.length/2).

  string.length(Str0, Len) :-
      % XXX This copy is only necessary because of the ui.
@@ -3495,7 +3477,7 @@

  /*-----------------------------------------------------------------------*/

-:- pragma promise_pure(string.append/3).
+:- pragma promise_equivalent_clauses(string.append/3).

  string.append(S1::in, S2::in, S3::in) :-
      string.append_iii(S1, S2, S3).
@@ -4216,8 +4198,8 @@
      value_to_revstrings(NonCanon, OpsTable, X, [], RevStrings),
      String = string.append_list(list.reverse(RevStrings)).

-:- pred value_to_revstrings(deconstruct.noncanon_handling,
-    ops.table, T, revstrings, revstrings).
+:- pred value_to_revstrings(noncanon_handling, ops.table, T,
+    revstrings, revstrings).
  :- mode value_to_revstrings(in(do_not_allow), in, in, in, out) is det.
  :- mode value_to_revstrings(in(canonicalize), in, in, in, out) is det.
  :- mode value_to_revstrings(in(include_details_cc), in, in, in, out)
@@ -4228,8 +4210,8 @@
      Priority = ops.max_priority(OpsTable) + 1,
      value_to_revstrings_prio(NonCanon, OpsTable, Priority, X, !Rs).

-:- pred value_to_revstrings_prio(deconstruct.noncanon_handling,
-    ops.table, ops.priority, T, revstrings, revstrings).
+:- pred value_to_revstrings_prio(noncanon_handling, ops.table, ops.priority, T,
+    revstrings, revstrings).
  :- mode value_to_revstrings_prio(in(do_not_allow), in, in, in, in, out) is det.
  :- mode value_to_revstrings_prio(in(canonicalize), in, in, in, in, out) is det.
  :- mode value_to_revstrings_prio(in(include_details_cc), in, in, in, in, out)
@@ -4238,7 +4220,7 @@

  value_to_revstrings_prio(NonCanon, OpsTable, Priority, X, !Rs) :-
      %
-    % we need to special-case the builtin types:
+    % We need to special-case the builtin types:
      %   int, char, float, string
      %   type_info, univ, c_pointer, array
      %   and private_builtin.type_info
@@ -4271,15 +4253,15 @@
          % rather than the reverse) is also chosen for efficiency, to find
          % failure cheaply in the common cases, rather than for readability.
          %
-        type_desc.type_ctor_and_args(type_of(X), TypeCtor, ArgTypes),
+        type_ctor_and_args(type_of(X), TypeCtor, ArgTypes),
          ArgTypes = [ElemType],
-        type_desc.type_ctor_name(TypeCtor) = "array",
-        type_desc.type_ctor_module_name(TypeCtor) = "array"
+        type_ctor_name(TypeCtor) = "array",
+        type_ctor_module_name(TypeCtor) = "array"
      ->
          % Now that we know the element type, we can constrain the type of
          % the variable `Array' so that we can use det_dynamic_cast.
          %
-        type_desc.has_type(Elem, ElemType),
+        has_type(Elem, ElemType),
          same_array_elem_type(Array, Elem),
          det_dynamic_cast(X, Array),
          array_to_revstrings(NonCanon, OpsTable, Array, !Rs)
@@ -4287,12 +4269,12 @@
          % Check if the type is private_builtin.type_info/1.
          % See the comments above for array.array/1.
          %
-        type_desc.type_ctor_and_args(type_of(X), TypeCtor, ArgTypes),
+        type_ctor_and_args(type_of(X), TypeCtor, ArgTypes),
          ArgTypes = [ElemType],
-        type_desc.type_ctor_name(TypeCtor) = "type_info",
-        type_desc.type_ctor_module_name(TypeCtor) = "private_builtin"
+        type_ctor_name(TypeCtor) = "type_info",
+        type_ctor_module_name(TypeCtor) = "private_builtin"
      ->
-        type_desc.has_type(Elem, ElemType),
+        has_type(Elem, ElemType),
          same_private_builtin_type(PrivateBuiltinTypeInfo, Elem),
          det_dynamic_cast(X, PrivateBuiltinTypeInfo),
          private_builtin_type_info_to_revstrings(PrivateBuiltinTypeInfo, !Rs)
@@ -4309,8 +4291,8 @@

  same_private_builtin_type(_, _).

-:- pred ordinary_term_to_revstrings(deconstruct.noncanon_handling,
-    ops.table, ops.priority, T, revstrings, revstrings).
+:- pred ordinary_term_to_revstrings(noncanon_handling, ops.table,
+    ops.priority, T, revstrings, revstrings).
  :- mode ordinary_term_to_revstrings(in(do_not_allow), in, in, in, in, out)
      is det.
  :- mode ordinary_term_to_revstrings(in(canonicalize), in, in, in, in, out)
@@ -4321,7 +4303,7 @@
      is cc_multi.

  ordinary_term_to_revstrings(NonCanon, OpsTable, Priority, X, !Rs) :-
-    deconstruct.deconstruct(X, NonCanon, Functor, _Arity, Args),
+    deconstruct(X, NonCanon, Functor, _Arity, Args),
      (
          Functor = "[|]",
          Args = [ListHead, ListTail]
@@ -4451,8 +4433,8 @@
  adjust_priority(Priority, ops.y, Priority).
  adjust_priority(Priority, ops.x, Priority - 1).

-:- pred univ_list_tail_to_revstrings(deconstruct.noncanon_handling,
-    ops.table, univ, revstrings, revstrings).
+:- pred univ_list_tail_to_revstrings(noncanon_handling, ops.table, univ,
+    revstrings, revstrings).
  :- mode univ_list_tail_to_revstrings(in(do_not_allow), in, in, in, out) is det.
  :- mode univ_list_tail_to_revstrings(in(canonicalize), in, in, in, out) is det.
  :- mode univ_list_tail_to_revstrings(in(include_details_cc), in, in, in, out)
@@ -4460,8 +4442,7 @@
  :- mode univ_list_tail_to_revstrings(in, in, in, in, out) is cc_multi.

  univ_list_tail_to_revstrings(NonCanon, OpsTable, Univ, !Rs) :-
-    deconstruct.deconstruct(univ_value(Univ), NonCanon, Functor, _Arity,
-        Args),
+    deconstruct(univ_value(Univ), NonCanon, Functor, _Arity, Args),
      (
          Functor = "[|]",
          Args = [ListHead, ListTail]
@@ -4481,8 +4462,8 @@

      % Write the remaining arguments.
      %
-:- pred term_args_to_revstrings(deconstruct.noncanon_handling,
-    ops.table, list(univ), revstrings, revstrings).
+:- pred term_args_to_revstrings(noncanon_handling, ops.table, list(univ),
+    revstrings, revstrings).
  :- mode term_args_to_revstrings(in(do_not_allow), in, in, in, out) is det.
  :- mode term_args_to_revstrings(in(canonicalize), in, in, in, out) is det.
  :- mode term_args_to_revstrings(in(include_details_cc), in, in, in, out)
@@ -4495,7 +4476,7 @@
      arg_to_revstrings(NonCanon, OpsTable, X, !Rs),
      term_args_to_revstrings(NonCanon, OpsTable, Xs, !Rs).

-:- pred arg_to_revstrings(deconstruct.noncanon_handling,
+:- pred arg_to_revstrings(noncanon_handling,
      ops.table, univ, revstrings, revstrings).
  :- mode arg_to_revstrings(in(do_not_allow), in, in, in, out) is det.
  :- mode arg_to_revstrings(in(canonicalize), in, in, in, out) is det.
@@ -4519,8 +4500,8 @@

  comma_priority(_OpTable) = 1000.

-:- pred array_to_revstrings(deconstruct.noncanon_handling,
-    ops.table, array(T), revstrings, revstrings).
+:- pred array_to_revstrings(noncanon_handling, ops.table, array(T),
+    revstrings, revstrings).
  :- mode array_to_revstrings(in(do_not_allow), in, in, in, out) is det.
  :- mode array_to_revstrings(in(canonicalize), in, in, in, out) is det.
  :- mode array_to_revstrings(in(include_details_cc), in, in, in, out)
@@ -4533,13 +4514,13 @@
          array.to_list(Array) `with_type` list(T), !Rs),
      add_revstring(")", !Rs).

-:- pred type_desc_to_revstrings(type_desc.type_desc::in,
+:- pred type_desc_to_revstrings(type_desc::in,
      revstrings::in, revstrings::out) is det.

  type_desc_to_revstrings(TypeDesc, !Rs) :-
-    add_revstring(term_io.quoted_atom(type_desc.type_name(TypeDesc)), !Rs).
+    add_revstring(term_io.quoted_atom(type_name(TypeDesc)), !Rs).

-:- pred type_ctor_desc_to_revstrings(type_desc.type_ctor_desc::in,
+:- pred type_ctor_desc_to_revstrings(type_ctor_desc::in,
      revstrings::in, revstrings::out) is det.

  type_ctor_desc_to_revstrings(TypeCtorDesc, !Rs) :-
@@ -4550,7 +4531,7 @@
          ModuleName = "builtin",
          Name = "func"
      ->
-        % The type ctor that we call `builtin:func/N' takes N + 1 type
+        % The type ctor that we call `builtin.func/N' takes N + 1 type
          % parameters: N arguments plus one return value. So we need to subtract
          % one from the arity here.
          Arity = Arity0 - 1
Index: library/term.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term.m,v
retrieving revision 1.123
diff -u -r1.123 term.m
--- library/term.m	27 Sep 2006 06:16:44 -0000	1.123
+++ library/term.m	20 Oct 2006 13:36:00 -0000
@@ -494,7 +494,7 @@
      try_term_to_univ_2(Term, Type, [], Result).

  :- pred try_term_to_univ_2(term(T)::in,
-    type_desc.type_desc::in, term_to_type_context::in,
+    type_desc::in, term_to_type_context::in,
      term_to_type_result(univ, T)::out) is det.

  try_term_to_univ_2(variable(Var), _Type, Context,
@@ -502,10 +502,10 @@
  try_term_to_univ_2(Term, Type, Context, Result) :-
      Term = functor(Functor, ArgTerms, TermContext),
      (
-        type_desc.type_ctor_and_args(Type, TypeCtor, TypeArgs),
+        type_ctor_and_args(Type, TypeCtor, TypeArgs),
          term_to_univ_special_case(
-            type_desc.type_ctor_module_name(TypeCtor),
-            type_desc.type_ctor_name(TypeCtor),
+            type_ctor_module_name(TypeCtor),
+            type_ctor_name(TypeCtor),
              TypeArgs, Term, Type, Context, SpecialCaseResult)
      ->
          Result = SpecialCaseResult
@@ -535,7 +535,7 @@
      ).

  :- pred term_to_univ_special_case(string::in, string::in,
-    list(type_desc.type_desc)::in,
+    list(type_desc)::in,
      term(T)::in(bound(functor(ground, ground, ground))),
      type_desc.type_desc::in, term_to_type_context::in,
      term_to_type_result(univ, T)::out) is semidet.
@@ -567,14 +567,14 @@
      % convert the term representing the list of elements back to a list,
      % and then (if successful) we just call the array/1 function.
      %
-    type_desc.has_type(Elem, ElemType),
-    ListType = type_desc.type_of([Elem]),
+    has_type(Elem, ElemType),
+    ListType = type_of([Elem]),
      ArgContext = arg_context(atom("array"), 1, TermContext),
      NewContext = [ArgContext | PrevContext],
      try_term_to_univ_2(ArgList, ListType, NewContext, ArgResult),
      (
          ArgResult = ok(ListUniv),
-        type_desc.has_type(Elem2, ElemType),
+        has_type(Elem2, ElemType),
          same_type(List, [Elem2]),
          det_univ_to_type(ListUniv, List),
          Array = array(List),
@@ -613,7 +613,7 @@
      fail.

  :- pred term_list_to_univ_list(list(term(T))::in,
-    list(type_desc.type_desc)::in, const::in, int::in,
+    list(type_desc)::in, const::in, int::in,
      term_to_type_context::in, context::in,
      term_to_type_result(list(univ), T)::out) is semidet.

@@ -639,14 +639,14 @@
          Result = error(Error)
      ).

-:- pred find_functor(type_desc.type_desc::in, string::in, int::in,
+:- pred find_functor(type_desc::in, string::in, int::in,
      int::out, list(type_desc.type_desc)::out) is semidet.

  find_functor(Type, Functor, Arity, FunctorNumber, ArgTypes) :-
      N = construct.num_functors(Type),
      find_functor_2(Type, Functor, Arity, N, FunctorNumber, ArgTypes).

-:- pred find_functor_2(type_desc.type_desc::in, string::in, int::in,
+:- pred find_functor_2(type_desc::in, string::in, int::in,
      int::in, int::out, list(type_desc)::out) is semidet.

  find_functor_2(TypeInfo, Functor, Arity, Num, FunctorNumber, ArgTypes) :-
@@ -668,7 +668,7 @@
      ;
          Message = "term.det_term_to_type failed, due to a type error:\n"
              ++ "the term wasn't a valid term for type `"
-            ++ type_desc.type_name(type_desc.type_of(X)) ++ "'",
+            ++ type_name(type_of(X)) ++ "'",
          error(Message)
      ).

@@ -683,16 +683,16 @@
      % NU-Prolog barfs on `num_functors(Type) < 0'
      ( construct.num_functors(Type) = N, N < 0 ->
          (
-            type_desc.type_ctor_and_args(Type, TypeCtor, TypeArgs),
-            TypeName = type_desc.type_ctor_name(TypeCtor),
-            ModuleName = type_desc.type_ctor_module_name(TypeCtor),
+            type_ctor_and_args(Type, TypeCtor, TypeArgs),
+            TypeName = type_ctor_name(TypeCtor),
+            ModuleName = type_ctor_module_name(TypeCtor),
              univ_to_term_special_case(ModuleName, TypeName, TypeArgs,
                  Univ, Context, SpecialCaseTerm)
          ->
              Term = SpecialCaseTerm
          ;
              Message = "term.type_to_term: unknown type `"
-                ++ type_desc.type_name(univ_type(Univ)) ++ "'",
+                ++ type_name(univ_type(Univ)) ++ "'",
              error(Message)
          )
      ;
@@ -703,7 +703,7 @@
      ).

  :- pred univ_to_term_special_case(string::in, string::in,
-    list(type_desc.type_desc)::in, univ::in, context::in, term(T)::out)
+    list(type_desc)::in, univ::in, context::in, term(T)::out)
      is semidet.

  univ_to_term_special_case("builtin", "int", [], Univ, Context,
@@ -735,7 +735,7 @@

  univ_to_term_special_case("array", "array", [ElemType], Univ, Context, Term) :-
      Term = functor(atom("array"), [ArgsTerm], Context),
-    type_desc.has_type(Elem, ElemType),
+    has_type(Elem, ElemType),
      same_type(List, [Elem]),
      det_univ_to_type(Univ, Array),
      array.to_list(Array, List),
@@ -754,13 +754,12 @@

      % Given a type_info, return a term that represents the name of that type.
      %
-:- pred type_info_to_term(context::in, type_desc.type_desc::in,
-    term(T)::out) is det.
+:- pred type_info_to_term(context::in, type_desc::in, term(T)::out) is det.

  type_info_to_term(Context, TypeInfo, Term) :-
-    type_desc.type_ctor_and_args(TypeInfo, TypeCtor, ArgTypes),
-    TypeName = type_desc.type_ctor_name(TypeCtor),
-    ModuleName = type_desc.type_ctor_name(TypeCtor),
+    type_ctor_and_args(TypeInfo, TypeCtor, ArgTypes),
+    TypeName = type_ctor_name(TypeCtor),
+    ModuleName = type_ctor_name(TypeCtor),
      list.map(type_info_to_term(Context), ArgTypes, ArgTerms),

      ( ModuleName = "builtin" ->
Index: library/tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.55
diff -u -r1.55 tree234.m
--- library/tree234.m	28 Apr 2006 02:48:00 -0000	1.55
+++ library/tree234.m	20 Oct 2006 14:54:07 -0000
@@ -2433,83 +2433,83 @@
  tree234.foldl(_Pred, empty, !A).
  tree234.foldl(Pred, two(K, V, T0, T1), !A) :-
      tree234.foldl(Pred, T0, !A),
-    call(Pred, K, V, !A),
+    Pred(K, V, !A),
      tree234.foldl(Pred, T1, !A).
  tree234.foldl(Pred, three(K0, V0, K1, V1, T0, T1, T2), !A) :-
      tree234.foldl(Pred, T0, !A),
-    call(Pred, K0, V0, !A),
+    Pred(K0, V0, !A),
      tree234.foldl(Pred, T1, !A),
-    call(Pred, K1, V1, !A),
+    Pred(K1, V1, !A),
      tree234.foldl(Pred, T2, !A).
  tree234.foldl(Pred, four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3), !A) :-
      tree234.foldl(Pred, T0, !A),
-    call(Pred, K0, V0, !A),
+    Pred(K0, V0, !A),
      tree234.foldl(Pred, T1, !A),
-    call(Pred, K1, V1, !A),
+    Pred(K1, V1, !A),
      tree234.foldl(Pred, T2, !A),
-    call(Pred, K2, V2, !A),
+    Pred(K2, V2, !A),
      tree234.foldl(Pred, T3, !A).

  tree234.foldl2(_Pred, empty, !A, !B).
  tree234.foldl2(Pred, two(K, V, T0, T1), !A, !B) :-
      tree234.foldl2(Pred, T0, !A, !B),
-    call(Pred, K, V, !A, !B),
+    Pred(K, V, !A, !B),
      tree234.foldl2(Pred, T1, !A, !B).
  tree234.foldl2(Pred, three(K0, V0, K1, V1, T0, T1, T2), !A, !B) :-
      tree234.foldl2(Pred, T0, !A, !B),
-    call(Pred, K0, V0, !A, !B),
+    Pred(K0, V0, !A, !B),
      tree234.foldl2(Pred, T1, !A, !B),
-    call(Pred, K1, V1, !A, !B),
+    Pred(K1, V1, !A, !B),
      tree234.foldl2(Pred, T2, !A, !B).
  tree234.foldl2(Pred, four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3), !A, !B) :-
      tree234.foldl2(Pred, T0, !A, !B),
-    call(Pred, K0, V0, !A, !B),
+    Pred(K0, V0, !A, !B),
      tree234.foldl2(Pred, T1, !A, !B),
-    call(Pred, K1, V1, !A, !B),
+    Pred(K1, V1, !A, !B),
      tree234.foldl2(Pred, T2, !A, !B),
-    call(Pred, K2, V2, !A, !B),
+    Pred(K2, V2, !A, !B),
      tree234.foldl2(Pred, T3, !A, !B).

  tree234.foldl3(_Pred, empty, !A, !B, !C).
  tree234.foldl3(Pred, two(K, V, T0, T1), !A, !B, !C) :-
      tree234.foldl3(Pred, T0, !A, !B, !C),
-    call(Pred, K, V, !A, !B, !C),
+    Pred(K, V, !A, !B, !C),
      tree234.foldl3(Pred, T1, !A, !B, !C).
  tree234.foldl3(Pred, three(K0, V0, K1, V1, T0, T1, T2), !A, !B, !C) :-
      tree234.foldl3(Pred, T0, !A, !B, !C),
-    call(Pred, K0, V0, !A, !B, !C),
+    Pred(K0, V0, !A, !B, !C),
      tree234.foldl3(Pred, T1, !A, !B, !C),
-    call(Pred, K1, V1, !A, !B, !C),
+    Pred(K1, V1, !A, !B, !C),
      tree234.foldl3(Pred, T2, !A, !B, !C).
  tree234.foldl3(Pred, four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3),
          !A, !B, !C) :-
      tree234.foldl3(Pred, T0, !A, !B, !C),
-    call(Pred, K0, V0, !A, !B, !C),
+    Pred(K0, V0, !A, !B, !C),
      tree234.foldl3(Pred, T1, !A, !B, !C),
-    call(Pred, K1, V1, !A, !B, !C),
+    Pred(K1, V1, !A, !B, !C),
      tree234.foldl3(Pred, T2, !A, !B, !C),
-    call(Pred, K2, V2, !A, !B, !C),
+    Pred(K2, V2, !A, !B, !C),
      tree234.foldl3(Pred, T3, !A, !B, !C).

  tree234.foldl4(_Pred, empty, !A, !B, !C, !D).
  tree234.foldl4(Pred, two(K, V, T0, T1), !A, !B, !C, !D) :-
  	tree234.foldl4(Pred, T0, !A, !B, !C, !D),
-	call(Pred, K, V, !A, !B, !C, !D),
+	Pred(K, V, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T1, !A, !B, !C, !D).
  tree234.foldl4(Pred, three(K0, V0, K1, V1, T0, T1, T2), !A, !B, !C, !D) :-
  	tree234.foldl4(Pred, T0, !A, !B, !C, !D),
-	call(Pred, K0, V0, !A, !B, !C, !D),
+	Pred(K0, V0, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T1, !A, !B, !C, !D),
-	call(Pred, K1, V1, !A, !B, !C, !D),
+	Pred(K1, V1, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T2, !A, !B, !C, !D).
  tree234.foldl4(Pred, four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3),
  		!A, !B, !C, !D) :-
  	tree234.foldl4(Pred, T0, !A, !B, !C, !D),
-	call(Pred, K0, V0, !A, !B, !C, !D),
+	Pred(K0, V0, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T1, !A, !B, !C, !D),
-	call(Pred, K1, V1, !A, !B, !C, !D),
+	Pred(K1, V1, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T2, !A, !B, !C, !D),
-	call(Pred, K2, V2, !A, !B, !C, !D),
+	Pred(K2, V2, !A, !B, !C, !D),
  	tree234.foldl4(Pred, T3, !A, !B, !C, !D).

  %------------------------------------------------------------------------------%
@@ -2517,86 +2517,85 @@
  tree234.map_values(_Pred, empty, empty).
  tree234.map_values(Pred, Tree0, Tree) :-
      Tree0 = two(K0, V0, Left0, Right0),
-    call(Pred, K0, V0, W0),
+    Pred(K0, V0, W0),
      tree234.map_values(Pred, Left0, Left),
      tree234.map_values(Pred, Right0, Right),
-    Tree  = two(K0, W0, Left, Right).
+    Tree = two(K0, W0, Left, Right).
  tree234.map_values(Pred, Tree0, Tree) :-
      Tree0 = three(K0, V0, K1, V1, Left0, Middle0, Right0),
-    call(Pred, K0, V0, W0),
-    call(Pred, K1, V1, W1),
+    Pred(K0, V0, W0),
+    Pred(K1, V1, W1),
      tree234.map_values(Pred, Left0, Left),
      tree234.map_values(Pred, Middle0, Middle),
      tree234.map_values(Pred, Right0, Right),
-    Tree  = three(K0, W0, K1, W1, Left, Middle, Right).
+    Tree = three(K0, W0, K1, W1, Left, Middle, Right).
  tree234.map_values(Pred, Tree0, Tree) :-
      Tree0 = four(K0, V0, K1, V1, K2, V2, Left0, LMid0, RMid0, Right0),
-    call(Pred, K0, V0, W0),
-    call(Pred, K1, V1, W1),
-    call(Pred, K2, V2, W2),
+    Pred(K0, V0, W0),
+    Pred(K1, V1, W1),
+    Pred(K2, V2, W2),
      tree234.map_values(Pred, Left0, Left),
      tree234.map_values(Pred, LMid0, LMid),
      tree234.map_values(Pred, RMid0, RMid),
      tree234.map_values(Pred, Right0, Right),
-    Tree  = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right).
+    Tree = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right).

  %------------------------------------------------------------------------------%

  tree234.map_foldl(_Pred, empty, empty, !A).
  tree234.map_foldl(Pred, Tree0, Tree, !A) :-
      Tree0 = two(K0, V0, Left0, Right0),
-    Tree  = two(K0, W0, Left, Right),
      tree234.map_foldl(Pred, Left0, Left, !A),
-    call(Pred, K0, V0, W0, !A),
-    tree234.map_foldl(Pred, Right0, Right, !A).
+    Pred(K0, V0, W0, !A),
+    tree234.map_foldl(Pred, Right0, Right, !A),
+    Tree = two(K0, W0, Left, Right).
  tree234.map_foldl(Pred, Tree0, Tree, !A) :-
      Tree0 = three(K0, V0, K1, V1, Left0, Middle0, Right0),
-    Tree  = three(K0, W0, K1, W1, Left, Middle, Right),
      tree234.map_foldl(Pred, Left0, Left, !A),
-    call(Pred, K0, V0, W0, !A),
+    Pred(K0, V0, W0, !A),
      tree234.map_foldl(Pred, Middle0, Middle, !A),
-    call(Pred, K1, V1, W1, !A),
-    tree234.map_foldl(Pred, Right0, Right, !A).
+    Pred(K1, V1, W1, !A),
+    tree234.map_foldl(Pred, Right0, Right, !A),
+    Tree = three(K0, W0, K1, W1, Left, Middle, Right).
  tree234.map_foldl(Pred, Tree0, Tree, !A) :-
      Tree0 = four(K0, V0, K1, V1, K2, V2, Left0, LMid0, RMid0, Right0),
-    Tree  = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right),
      tree234.map_foldl(Pred, Left0, Left, !A),
-    call(Pred, K0, V0, W0, !A),
+    Pred(K0, V0, W0, !A),
      tree234.map_foldl(Pred, LMid0, LMid, !A),
-    call(Pred, K1, V1, W1, !A),
+    Pred(K1, V1, W1, !A),
      tree234.map_foldl(Pred, RMid0, RMid, !A),
-    call(Pred, K2, V2, W2, !A),
-    tree234.map_foldl(Pred, Right0, Right, !A).
+    Pred(K2, V2, W2, !A),
+    tree234.map_foldl(Pred, Right0, Right, !A),
+    Tree = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right).

  tree234.map_foldl2(_Pred, empty, empty, !A, !B).
  tree234.map_foldl2(Pred, Tree0, Tree, !A, !B) :-
      Tree0 = two(K0, V0, Left0, Right0),
-    Tree  = two(K0, W0, Left, Right),
      tree234.map_foldl2(Pred, Left0, Left, !A, !B),
-    call(Pred, K0, V0, W0, !A, !B),
-    tree234.map_foldl2(Pred, Right0, Right, !A, !B).
+    Pred(K0, V0, W0, !A, !B),
+    tree234.map_foldl2(Pred, Right0, Right, !A, !B),
+    Tree = two(K0, W0, Left, Right).
  tree234.map_foldl2(Pred, Tree0, Tree, !A, !B) :-
      Tree0 = three(K0, V0, K1, V1, Left0, Middle0, Right0),
-    Tree  = three(K0, W0, K1, W1, Left, Middle, Right),
      tree234.map_foldl2(Pred, Left0, Left, !A, !B),
-    call(Pred, K0, V0, W0, !A, !B),
+    Pred(K0, V0, W0, !A, !B),
      tree234.map_foldl2(Pred, Middle0, Middle, !A, !B),
-    call(Pred, K1, V1, W1, !A, !B),
-    tree234.map_foldl2(Pred, Right0, Right, !A, !B).
+    Pred(K1, V1, W1, !A, !B),
+    tree234.map_foldl2(Pred, Right0, Right, !A, !B),
+    Tree = three(K0, W0, K1, W1, Left, Middle, Right).
  tree234.map_foldl2(Pred, Tree0, Tree, !A, !B) :-
      Tree0 = four(K0, V0, K1, V1, K2, V2, Left0, LMid0, RMid0, Right0),
-    Tree  = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right),
      tree234.map_foldl2(Pred, Left0, Left, !A, !B),
-    call(Pred, K0, V0, W0, !A, !B),
+    Pred(K0, V0, W0, !A, !B),
      tree234.map_foldl2(Pred, LMid0, LMid, !A, !B),
-    call(Pred, K1, V1, W1, !A, !B),
+    Pred(K1, V1, W1, !A, !B),
      tree234.map_foldl2(Pred, RMid0, RMid, !A, !B),
-    call(Pred, K2, V2, W2, !A, !B),
-    tree234.map_foldl2(Pred, Right0, Right, !A, !B).
+    Pred(K2, V2, W2, !A, !B),
+    tree234.map_foldl2(Pred, Right0, Right, !A, !B),
+    Tree = four(K0, W0, K1, W1, K2, W2, Left, LMid, RMid, Right).

  %------------------------------------------------------------------------------%

-    % count the number of elements in a tree
  tree234.count(empty, 0).
  tree234.count(two(_, _, T0, T1), N) :-
      tree234.count(T0, N0),
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.43
diff -u -r1.43 type_desc.m
--- library/type_desc.m	1 Oct 2006 04:57:39 -0000	1.43
+++ library/type_desc.m	20 Oct 2006 15:21:21 -0000
@@ -18,6 +18,8 @@

  :- import_module list.

+%-----------------------------------------------------------------------------%
+
      % The `type_desc', `pseudo_type_desc' and `type_ctor_desc' types
      % provide access to type information.
      % A type_desc represents a type, e.g. `list(int)'.
@@ -293,8 +295,9 @@
  ").

  %-----------------------------------------------------------------------------%
-
-% Code for type manipulation.
+%
+% Code for type manipulation
+%

  pseudo_type_desc_is_ground(PseudoTypeDesc) :-
      pseudo_type_ctor_and_args(PseudoTypeDesc, _TypeCtor, ArgPseudos),
Index: library/univ.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/univ.m,v
retrieving revision 1.3
diff -u -r1.3 univ.m
--- library/univ.m	31 Aug 2006 11:09:53 -0000	1.3
+++ library/univ.m	20 Oct 2006 15:17:48 -0000
@@ -111,7 +111,7 @@

  univ_value(univ_cons(X)) = X.

-:- pragma promise_pure(type_to_univ/2).
+:- pragma promise_equivalent_clauses(type_to_univ/2).

  type_to_univ(T::di, Univ::uo) :-
      Univ0 = 'new univ_cons'(T),
@@ -123,17 +123,15 @@
      Univ = univ_cons(T0),
      private_builtin.typed_unify(T0, T).

-univ_type(Univ) = type_desc.type_of(univ_value(Univ)).
+univ_type(Univ) = type_of(univ_value(Univ)).

-:- pred construct_univ(T, univ).
-:- mode construct_univ(in, out) is det.
+:- pred construct_univ(T::in, univ::out) is det.
  :- pragma foreign_export("C", construct_univ(in, out), "ML_construct_univ").

  construct_univ(X, Univ) :-
      Univ = univ(X).

-:- some [T] pred unravel_univ(univ, T).
-:- mode unravel_univ(in, out) is det.
+:- some [T] pred unravel_univ(univ::in, T::out) is det.
  :- pragma foreign_export("C", unravel_univ(in, out), "ML_unravel_univ").

  unravel_univ(Univ, X) :-
Index: vim/syntax/mercury.vim
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/vim/syntax/mercury.vim,v
retrieving revision 1.18
diff -u -r1.18 mercury.vim
--- vim/syntax/mercury.vim	7 Dec 2005 04:57:10 -0000	1.18
+++ vim/syntax/mercury.vim	20 Oct 2006 11:37:18 -0000
@@ -46,6 +46,7 @@
  syn keyword mercuryPragma       type_spec source_file fact_table obsolete
  syn keyword mercuryPragma       memo loop_check minimal_model
  syn keyword mercuryPragma       terminates does_not_terminate check_termination
+syn keyword mercuryPragma       promise_equivalent_clauses
  syn keyword mercuryCInterface   c_header_code c_code
  syn keyword mercuryCInterface   foreign_proc foreign_decl foreign_code
  syn keyword mercuryCInterface   foreign_type foreign_import_module

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list