[m-rev.] for review: more disambiguations

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Sep 20 17:33:11 AEST 2006


Depending on how you measure it, this diff removes 3 to 5% of the ambiguities
of procedure names in the compiler.

Zoltan.

Get rid of a bunch more ambiguities by renaming predicates, mostly
in polymorphism.m, {abstract,build,ordering}_mode_constraints.m, prog_type.m,
and opt_debug.m in the compiler directory and term_io.m, term.m, parser.m,
and string.m in the library.

In some cases, when the library and the compiler defined the same predicate
with the same code, delete the compiler's copy and give it access to the
library's definition by exporting the relevant predicate (in the undocumented
part of the library module's interface).

NEWS:
	Mention that the names of some library functions have changed.

library/*.m:
compiler/*.m:
mdbcomp/*.m:
browser/*.m:
	Make the changes mentioned above, and conform to them.

test/general/string_test.m:
test/hard_coded/string_strip.m:
test/hard_coded/string_strip.exp:
	Conform to the above changes.

cvs diff: Diffing .
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.422
diff -u -b -r1.422 NEWS
--- NEWS	15 Sep 2006 09:11:22 -0000	1.422
+++ NEWS	20 Sep 2006 05:53:00 -0000
@@ -20,6 +20,8 @@
 * We have added string.c_pointer_to_string/{1,2} and string.from_c_pointer/1
   to convert c_pointers to a human readable form.
 
+* We have renamed some library predicates whose names were ambiguous.
+
 Changes to the Mercury compiler:
 
 * The compiler now issues a warning when an inst declaration is not
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.64
diff -u -b -r1.64 declarative_user.m
--- browser/declarative_user.m	22 Aug 2006 05:03:30 -0000	1.64
+++ browser/declarative_user.m	19 Sep 2006 15:16:11 -0000
@@ -861,7 +861,7 @@
     util.trace_getline(Prompt, Result, User ^ instr, User ^ outstr, !IO),
     (
         Result = ok(String),
-        Words = string.words(char.is_whitespace, String),
+        Words = string.words_separator(char.is_whitespace, String),
         (
             Words = [CmdWord | CmdArgs],
             (
@@ -1048,7 +1048,7 @@
         From = Num,
         To = Num
     ;
-        [FirstStr, SecondStr] = string.words(is_dash, Arg),
+        [FirstStr, SecondStr] = string.words_separator(is_dash, Arg),
         string.to_int(FirstStr, First),
         string.to_int(SecondStr, Second),
         ( First =< Second ->
Index: browser/name_mangle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/name_mangle.m,v
retrieving revision 1.12
diff -u -b -r1.12 name_mangle.m
--- browser/name_mangle.m	6 Jun 2006 02:27:15 -0000	1.12
+++ browser/name_mangle.m	19 Sep 2006 15:16:16 -0000
@@ -172,7 +172,7 @@
 :- pred name_mangle(string::in, string::out) is det.
 
 name_mangle(Name, MangledName) :-
-    ( string.is_alnum_or_underscore(Name) ->
+    ( string.is_all_alnum_or_underscore(Name) ->
         % any names that start with `f_' are changed so that
         % they start with `f__', so that we can use names starting
         % with `f_' (followed by anything except an underscore)
Index: browser/parse.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/parse.m,v
retrieving revision 1.31
diff -u -b -r1.31 parse.m
--- browser/parse.m	6 Jun 2006 02:27:15 -0000	1.31
+++ browser/parse.m	19 Sep 2006 15:16:26 -0000
@@ -215,7 +215,7 @@
 
 read_command(Prompt, Command, !IO) :-
     util.trace_get_command(Prompt, Line, !IO),
-    string.words(char.is_whitespace, Line) = Words,
+    string.words_separator(char.is_whitespace, Line) = Words,
     ( parse(Words, Command2) ->
         Command = Command2
     ;
@@ -226,7 +226,7 @@
     io.read(Result, !IO),
     (
         Result = ok(external_request(StringToParse)),
-        string.words(char.is_whitespace, StringToParse) = Words,
+        string.words_separator(char.is_whitespace, StringToParse) = Words,
         ( parse(Words, Command2) ->
             Command = Command2
         ;
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/abstract_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/abstract_mode_constraints.m,v
retrieving revision 1.9
diff -u -b -r1.9 abstract_mode_constraints.m
--- compiler/abstract_mode_constraints.m	31 Jul 2006 08:31:25 -0000	1.9
+++ compiler/abstract_mode_constraints.m	19 Sep 2006 13:13:24 -0000
@@ -52,8 +52,8 @@
 % paper "Constraint-based mode analysis of Mercury" by David Overton,
 % Zoltan Somogyi and Peter Stuckey documents these mode constraints.
 
-    % Represents conjunctions and disjunctions between atomic
-    % constraints on constraint variables.
+    % Represents conjunctions and disjunctions between atomic constraints
+    % on constraint variables.
     %
 :- type constraint_formulae == list(constraint_formula).
 :- type constraint_formula
@@ -114,27 +114,27 @@
     %
 :- type constraint_annotation
     --->    constraint_annotation(
+                % Context of the goal this constraint was formed for.
                 context     ::      prog_context
-                                    % Context of the goal this constraint
-                                    % was formed for.
             ).
 
     % producer/consumer constraints for a predicate.
     %
-:- type pred_p_c_constraints --->
-    pred_constraints(
-        proc_constraints    ::  multi_map(proc_id, constraint_and_annotation),
-                                % Stores procedure specific constraints
-                                % such as mode declaration constraints.
+:- type pred_p_c_constraints
+    --->    pred_constraints(
+                % Stores procedure specific constraints such as mode
+                % declaration constraints.
+                proc_constraints    ::  multi_map(proc_id,
+                                            constraint_and_annotation),
+
+                % Stores constraints that apply to all procedures of the
+                % predicate - typically generated from its clauses.
         pred_constraints    ::  assoc_list(constraint_formula,
                                     constraint_annotation),
-                                % Stores constraints that apply to all
-                                % procedures of the predicate -
-                                % typically generated from its clauses.
+
+                % Collection of predicates with no declared modes that are
+                % called by this predicate.
         mode_infer_callees  ::  set(pred_id)
-                                % Collection of predicates with no
-                                % declared modes that are called by
-                                % this predicate.
     ).
 
 %-----------------------------------------------------------------------------%
@@ -163,15 +163,21 @@
     %
 :- func init = pred_p_c_constraints.
 
-    % add_constraint(Formula, !PredConstraints) adds the constraint
-    % given by Formula to the constraint system in PredConstraints.
+    % add_constraint(Context, Formula, !PredConstraints):
+    %
+    % adds the constraint given by Formula to the constraint system
+    % in PredConstraints.
     %
 :- pred add_constraint(prog_context::in, constraint_formula::in,
     pred_p_c_constraints::in, pred_p_c_constraints::out) is det.
 
-    % Adds a procedure specific constraint to the system.
+    % add_proc_specific_constraint(Context, ProcId, Formula, !PredConstraints):
     %
-:- pred add_constraint(prog_context::in, proc_id::in, constraint_formula::in,
+    % adds the constraint given by Formula to the constraint system in
+    % PredConstraints, and associates it specificaly with procedure ProcId.
+    %
+:- pred add_proc_specific_constraint(prog_context::in, proc_id::in,
+    constraint_formula::in,
     pred_p_c_constraints::in, pred_p_c_constraints::out) is det.
 
     % add_mode_infer_callee(PredId, !PredConstraints)
@@ -191,11 +197,11 @@
 :- func pred_constraints_to_formulae(pred_p_c_constraints)
     = constraint_formulae.
 
-    % pred_constraints_to_formulae/2 returns all constraints that
+    % pred_constraints_for_proc_to_formulae returns all constraints that
     % apply to the given procedure from the pred_p_c_constraints,
     % including constraints that apply to all procedures.
     %
-:- func pred_constraints_to_formulae(proc_id, pred_p_c_constraints)
+:- func pred_constraints_for_proc_to_formulae(proc_id, pred_p_c_constraints)
     = constraint_formulae.
 
     % pred_constraints_to_formulae_and_annotations returns constraints
@@ -205,12 +211,12 @@
 :- func pred_constraints_to_formulae_and_annotations(pred_p_c_constraints) =
     assoc_list(constraint_formula, constraint_annotation).
 
-    % pred_constraints_to_formulae_and_annotations(ProcId, PredConstraints)
+    % pred_constraints_for_proc_to_formulae_and_annotations
     % returns all constraints that apply to the given procedure from the
     % pred_p_c_constraints, including constraints that apply to all
     % procedures, with their constraint annotations, in pairs.
     %
-:- func pred_constraints_to_formulae_and_annotations(proc_id,
+:- func pred_constraints_for_proc_to_formulae_and_annotations(proc_id,
     pred_p_c_constraints)
     = assoc_list(constraint_formula, constraint_annotation).
 
@@ -239,9 +245,10 @@
     pred_p_c_constraints::in, pred_p_c_constraints::out) is det.
 
     % equiv_disj(Context, X, Ys, !Constraints) constrains X and Ys in
-    % Constraints such that (X <-> disj(Ys)) - ie if X is true at least one of
-    % Ys must be true, if X is false, all of Ys must be false. Context should
-    % be the context of the goal or declaration that imposed this constraint.
+    % Constraints such that (X <-> disj(Ys)) - i.e. if X is true at least one
+    % of the Ys must be true, if X is false, all of Ys must be false.
+    % Context should be the context of the goal or declaration that imposed
+    % this constraint.
     %
 :- pred equiv_disj(prog_context::in, mc_var::in, list(mc_var)::in,
     pred_p_c_constraints::in, pred_p_c_constraints::out) is det.
@@ -269,7 +276,7 @@
     pred_p_c_constraints::in, pred_p_c_constraints::out) is det.
 
     % xor(Context, A, B, !Constraints) constrains mode constraint variables A
-    % and B in Constraints by the constraint (A xor B), ie constrains exactly
+    % and B in Constraints by the constraint (A xor B), i.e. constrains exactly
     % one of them to be true. Context should be the context of the goal or
     % declaration that imposed this constraint.
     %
@@ -290,15 +297,13 @@
 
     % Dummy type used to distinguish mode constraint variables.
     %
-:- type mc_type ---> mc_type.
+:- type mc_type
+    --->    mc_type.
 
     % Initialises all the parts of a mode_constraints_info type.
     %
 init = pred_constraints(multi_map.init, [], set.init).
 
-    % add_constraint(Formula, !PredConstraints) adds the constraint
-    % given by Formula to the constraint system in PredConstraints.
-    %
 add_constraint(Context, ConstraintFormula, !PredConstraints) :-
     AllProcsConstraints = !.PredConstraints ^ pred_constraints,
     ConstraintAnnotation = constraint_annotation(Context),
@@ -306,12 +311,8 @@
     !:PredConstraints = !.PredConstraints ^ pred_constraints :=
         list.cons(FormulaAndAnnotation, AllProcsConstraints).
 
-    % add_constraint(Context, ProcId, Formula, !PredConstraints) adds the
-    % constraint given by Formula to the constraint system in
-    % PredConstraints, and associates it specificaly with procedure
-    % ProcId.
-    %
-add_constraint(Context, ProcId, ConstraintFormula, !PredConstraints) :-
+add_proc_specific_constraint(Context, ProcId, ConstraintFormula,
+        !PredConstraints) :-
     ProcConstraints = !.PredConstraints ^ proc_constraints,
     ConstraintAnnotation = constraint_annotation(Context),
     FormulaAndAnnotation = pair(ConstraintFormula, ConstraintAnnotation),
@@ -332,7 +333,8 @@
     % apply to the given procedure from the pred_p_c_constraints,
     % including constraints that apply to all procedures.
     %
-pred_constraints_to_formulae(ProcId, PredConstraints) = ConstraintFormulae :-
+pred_constraints_for_proc_to_formulae(ProcId, PredConstraints)
+        = ConstraintFormulae :-
     ThisProcConstraints = multi_map.lookup(PredConstraints ^ proc_constraints,
         ProcId),
     AllProcConstraints = PredConstraints ^ pred_constraints,
@@ -351,8 +353,8 @@
     % pred_p_c_constraints, including constraints that apply to all
     % procedures, with their constraint annotations, in pairs.
     %
-pred_constraints_to_formulae_and_annotations(ProcId, PredConstraints) =
-        ConstraintFormulae :-
+pred_constraints_for_proc_to_formulae_and_annotations(ProcId, PredConstraints)
+        = ConstraintFormulae :-
     ThisProcConstraints = multi_map.lookup(PredConstraints ^ proc_constraints,
         ProcId),
     AllProcConstraints = PredConstraints ^ pred_constraints,
@@ -506,46 +508,46 @@
 
 pretty_print_constraints(VarSet, Constraints, !IO) :-
     Indent = "",
-    pretty_print_constraints(VarSet, Constraints, Indent, !IO).
+    pretty_print_constraints_indent(VarSet, Constraints, Indent, !IO).
 
     % Same as before, but with an indent argument used to indent
     % conjunctions and disjunctions of constraints.
     %
-:- pred pretty_print_constraints(mc_varset::in, constraint_formulae::in,
+:- pred pretty_print_constraints_indent(mc_varset::in, constraint_formulae::in,
     string::in, io::di, io::uo) is det.
 
-pretty_print_constraints(_VarSet, [], _Indent, !IO).
-pretty_print_constraints(VarSet, [Constr | Constrs], Indent, !IO) :-
-    pretty_print_constraint(VarSet, Constr, Indent, !IO),
-    pretty_print_constraints(VarSet, Constrs, Indent, !IO).
+pretty_print_constraints_indent(_VarSet, [], _Indent, !IO).
+pretty_print_constraints_indent(VarSet, [Constr | Constrs], Indent, !IO) :-
+    pretty_print_constraint_indent(VarSet, Constr, Indent, !IO),
+    pretty_print_constraints_indent(VarSet, Constrs, Indent, !IO).
 
-    % Prints one constraint_formulae to the output stream. Always
-    % puts a new line at the end.
+    % Prints one constraint_formulae to the output stream. Always puts
+    % a new line at the end.
     %
-:- pred pretty_print_constraint(mc_varset::in, constraint_formula::in,
+:- pred pretty_print_constraint_indent(mc_varset::in, constraint_formula::in,
     string::in, io::di, io::uo) is det.
 
-pretty_print_constraint(VarSet, disj(Constraints), Indent, !IO) :-
+pretty_print_constraint_indent(VarSet, disj(Constraints), Indent, !IO) :-
     io.write_string(Indent, !IO),
     io.write_string("disj(\n", !IO),
-    pretty_print_constraints(VarSet, Constraints, "\t" ++ Indent, !IO),
+    pretty_print_constraints_indent(VarSet, Constraints, "\t" ++ Indent, !IO),
     io.write_string(Indent, !IO),
     io.write_string(") end disj\n", !IO).
 
-pretty_print_constraint(VarSet, conj(Constraints), Indent, !IO) :-
+pretty_print_constraint_indent(VarSet, conj(Constraints), Indent, !IO) :-
     io.write_string(Indent, !IO),
     io.write_string("conj(\n", !IO),
-    pretty_print_constraints(VarSet, Constraints, "\t" ++ Indent, !IO),
+    pretty_print_constraints_indent(VarSet, Constraints, "\t" ++ Indent, !IO),
     io.write_string(Indent, !IO),
     io.write_string(") end conj\n", !IO).
 
-pretty_print_constraint(VarSet, atomic_constraint(Constraint), Indent, !IO) :-
+pretty_print_constraint_indent(VarSet, atomic_constraint(Constraint), Indent,
+        !IO) :-
     io.write_string(Indent, !IO),
     pretty_print_var_constraint(VarSet, Constraint, !IO),
     io.nl(!IO).
 
-    % Prints a var_constraint to the screen. No indents, no line
-    % return.
+    % Prints a var_constraint to the screen. No indents, no line return.
     %
 :- pred pretty_print_var_constraint(mc_varset::in, var_constraint::in,
     io::di, io::uo) is det.
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.48
diff -u -b -r1.48 add_pragma.m
--- compiler/add_pragma.m	10 Sep 2006 23:38:58 -0000	1.48
+++ compiler/add_pragma.m	19 Sep 2006 14:30:22 -0000
@@ -917,7 +917,7 @@
             set.list_to_set(VarsToSub, VarsToSubSet),
 
             assoc_list.values(Subst, SubstTypes0),
-            prog_type.vars_list(SubstTypes0, TVarsInSubstTypes0),
+            type_vars_list(SubstTypes0, TVarsInSubstTypes0),
             set.list_to_set(TVarsInSubstTypes0, TVarsInSubstTypes),
 
             set.intersect(TVarsInSubstTypes, VarsToSubSet, RecSubstTVars0),
Index: compiler/base_typeclass_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/base_typeclass_info.m,v
retrieving revision 1.47
diff -u -b -r1.47 base_typeclass_info.m
--- compiler/base_typeclass_info.m	22 Aug 2006 05:03:38 -0000	1.47
+++ compiler/base_typeclass_info.m	19 Sep 2006 14:22:26 -0000
@@ -125,7 +125,7 @@
         "been filled in by check_typeclass.m").
 gen_body(yes(PredProcIds0), Types, Constraints, ModuleInfo, ClassId,
         BaseTypeClassInfo) :-
-    prog_type.vars_list(Types, TypeVars),
+    type_vars_list(Types, TypeVars),
     get_unconstrained_tvars(TypeVars, Constraints, Unconstrained),
     list.length(Constraints, NumConstraints),
     list.length(Unconstrained, NumUnconstrained),
Index: compiler/build_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/build_mode_constraints.m,v
retrieving revision 1.19
diff -u -b -r1.19 build_mode_constraints.m
--- compiler/build_mode_constraints.m	5 Sep 2006 06:21:23 -0000	1.19
+++ compiler/build_mode_constraints.m	19 Sep 2006 13:11:51 -0000
@@ -669,12 +669,13 @@
 
 mode_decls_constraints(ModuleInfo, VarMap, PredId, Decls, HeadVarsList,
         Constraints) :-
-
     % Transform each headvar into the constraint variable representing
     % the proposition that it is produced at the empty goal path (ie
     % that it is produced by a call to the predicate).
     HeadVarsMCVars =
-        list.map(list.map(prog_var_at_path(VarMap, PredId, [])), HeadVarsList),
+        list.map(list.map(lookup_prog_var_at_path(VarMap, PredId, [])),
+            HeadVarsList),
+
     % Make the constraints for each declaration.
     ConstraintsList = list.map_corresponding(
         mode_decl_constraints(ModuleInfo), HeadVarsMCVars, Decls),
@@ -696,8 +697,8 @@
 
     DeclConstraints = mode_decl_constraints(ModuleInfo, ArgsAtHead, Decl),
 
-    list.foldl(abstract_mode_constraints.add_constraint(Context, ProcId),
-        DeclConstraints, !Constraints).
+    list.foldl(add_proc_specific_constraint(Context, ProcId), DeclConstraints,
+        !Constraints).
 
     % add_call_mode_decls_constraints(ModuleInfo, ProgVarset, Context,
     %   CallingPred, Decls, GoalPath, CallArgs, !VarInfo, !Constraints)
@@ -875,7 +876,7 @@
 
 add_variable_to_conjunct_production_map(VarMap, PredId, GoalPath, ProgVar,
         !ConjunctProductionMap) :-
-    MCVar = prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
+    MCVar = lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
     svmulti_map.set(ProgVar, MCVar, !ConjunctProductionMap).
 
     % add_nonlocal_var_conj_constraints(ProgVarset, PredId, Context, GoalPath,
@@ -949,7 +950,7 @@
     !.VarInfo = mc_var_info(MCVarset0, VarMap0),
     ensure_prog_var_at_path(ProgVarset, PredId, GoalPath, ProgVar,
         MCVarset0, MCVarset, VarMap0, VarMap),
-    MCVar = prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
+    MCVar = lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
     !:VarInfo = mc_var_info(MCVarset, VarMap).
 
     % prog_var_at_paths(ProgVarset, PredId, ProgVar, GoalPaths, MCVars,
@@ -1012,7 +1013,8 @@
         svbimap.det_insert(RepVar, NewMCVar, !VarMap)
     ).
 
-    % prog_var_at_path(VarMap, PredId, GoalPath, ProgVar) = ConstraintVar:
+    % lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar)
+    %   = ConstraintVar:
     %
     % Consults the VarMap to get the constraint variable ConstraintVar
     % that represents the proposition that ProgVar is produced at
@@ -1020,9 +1022,10 @@
     % error if the key (ProgVar `in` PredId) `at` GoalPath does not
     % exist in the map.
     %
-:- func prog_var_at_path(mc_var_map, pred_id, goal_path, prog_var) = mc_var.
+:- func lookup_prog_var_at_path(mc_var_map, pred_id, goal_path, prog_var)
+    = mc_var.
 
-prog_var_at_path(VarMap, PredId, GoalPath, ProgVar) =
+lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar) =
     bimap.lookup(VarMap, ((ProgVar `in` PredId) `at` GoalPath)).
 
     % Retrieves the mode constraint var as per prog_var_at_path, but
@@ -1032,7 +1035,7 @@
     list(mc_var)) = list(mc_var).
 
 cons_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar, MCVars) =
-    [prog_var_at_path(VarMap, PredId, GoalPath, ProgVar) | MCVars].
+    [lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar) | MCVars].
 
     % prog_var_at_paths(VarMap, GoalPaths, ProgVar) = ConstraintVars
     % consults the map to form a list of the constraint variable
@@ -1046,7 +1049,8 @@
 
 prog_var_at_paths(VarMap, PredId, GoalPaths, ProgVar) =
     list.map(
-        func(GoalPath) = prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
+        func(GoalPath) =
+            lookup_prog_var_at_path(VarMap, PredId, GoalPath, ProgVar),
         GoalPaths).
 
     % nonlocals_at_path_and_subpaths(ProgVarset, GoalPath, SubPaths,
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.99
diff -u -b -r1.99 check_typeclass.m
--- compiler/check_typeclass.m	10 Sep 2006 23:38:58 -0000	1.99
+++ compiler/check_typeclass.m	19 Sep 2006 14:23:47 -0000
@@ -673,7 +673,7 @@
     % the instance constraints.  (Type variables in the existq_tvars must
     % occur either in the argument types or in the class method context;
     % type variables in the instance types must appear in the arguments.)
-    prog_type.vars_list(ArgTypes1, ArgTVars),
+    type_vars_list(ArgTypes1, ArgTVars),
     prog_constraints_get_tvars(ClassMethodClassContext1, MethodContextTVars),
     constraint_list_get_tvars(InstanceConstraints1, InstanceTVars),
     list.condense([ArgTVars, MethodContextTVars, InstanceTVars], VarsToKeep0),
@@ -1236,9 +1236,9 @@
     Types = InstanceDefn ^ instance_types,
     FunDep = fundep(Domain, Range),
     DomainTypes = restrict_list_elements(Domain, Types),
-    prog_type.vars_list(DomainTypes, DomainVars),
+    type_vars_list(DomainTypes, DomainVars),
     RangeTypes = restrict_list_elements(Range, Types),
-    prog_type.vars_list(RangeTypes, RangeVars),
+    type_vars_list(RangeTypes, RangeVars),
     solutions.solutions((pred(V::out) is nondet :-
             list.member(V, RangeVars),
             \+ list.member(V, DomainVars)
@@ -1438,7 +1438,7 @@
     pred_info_get_typevarset(PredInfo, TVarSet),
     pred_info_get_arg_types(PredInfo, ArgTypes),
     pred_info_get_class_context(PredInfo, Constraints),
-    prog_type.vars_list(ArgTypes, TVars),
+    type_vars_list(ArgTypes, TVars),
     get_unbound_tvars(TVarSet, TVars, Constraints, !.ModuleInfo, UnboundTVars),
     (
         UnboundTVars = []
@@ -1470,7 +1470,7 @@
         !FoundError, !IO) :-
     Ctor = ctor(ExistQVars, Constraints, _, CtorArgs),
     assoc_list.values(CtorArgs, ArgTypes),
-    prog_type.vars_list(ArgTypes, ArgTVars),
+    type_vars_list(ArgTypes, ArgTVars),
     list.filter((pred(V::in) is semidet :- list.member(V, ExistQVars)),
         ArgTVars, ExistQArgTVars),
     get_type_defn_tvarset(TypeDefn, TVarSet),
@@ -1581,7 +1581,7 @@
 
 induced_vars(Args, ArgNum, Vars) = union(Vars, NewVars) :-
     Arg = list.index1_det(Args, ArgNum),
-    prog_type.vars(Arg, ArgVars),
+    type_vars(Arg, ArgVars),
     NewVars = set.list_to_set(ArgVars).
 
 :- func fundeps_closure(induced_fundeps, set(tvar)) = set(tvar).
Index: compiler/complexity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/complexity.m,v
retrieving revision 1.23
diff -u -b -r1.23 complexity.m
--- compiler/complexity.m	22 Aug 2006 05:03:41 -0000	1.23
+++ compiler/complexity.m	19 Sep 2006 13:50:32 -0000
@@ -570,7 +570,7 @@
         TypeInfoVar, TypeInfoGoals) :-
     module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
     create_poly_info(!.ModuleInfo, PredInfo0, !.ProcInfo, PolyInfo0),
-    polymorphism.make_type_info_var(Type, Context, TypeInfoVar,
+    polymorphism_make_type_info_var(Type, Context, TypeInfoVar,
         TypeInfoGoals, PolyInfo0, PolyInfo),
     poly_info_extract(PolyInfo, PredInfo0, PredInfo,
         !ProcInfo, !:ModuleInfo),
Index: compiler/constraint.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/constraint.m,v
retrieving revision 1.79
diff -u -b -r1.79 constraint.m
--- compiler/constraint.m	22 Aug 2006 05:03:41 -0000	1.79
+++ compiler/constraint.m	19 Sep 2006 13:29:00 -0000
@@ -580,19 +580,19 @@
 
 filter_dependent_constraints(NonLocals, GoalOutputVars, Constraints,
         Dependent, Independent) :-
-    filter_dependent_constraints(NonLocals, GoalOutputVars, Constraints,
+    filter_dependent_constraints_2(NonLocals, GoalOutputVars, Constraints,
         [], RevDependent, [], RevIndependent),
     list.reverse(RevDependent, Dependent),
     list.reverse(RevIndependent, Independent).
 
-:- pred filter_dependent_constraints(set(prog_var)::in, set(prog_var)::in,
+:- pred filter_dependent_constraints_2(set(prog_var)::in, set(prog_var)::in,
     list(constraint)::in,
     list(constraint)::in, list(constraint)::out,
     list(constraint)::in, list(constraint)::out) is det.
 
-filter_dependent_constraints(_NonLocals, _OutputVars, [],
+filter_dependent_constraints_2(_NonLocals, _OutputVars, [],
         !RevDependent, !RevIndependent).
-filter_dependent_constraints(NonLocals, GoalOutputVars,
+filter_dependent_constraints_2(NonLocals, GoalOutputVars,
         [Constraint | Constraints], !RevDependent, !RevIndependent) :-
     Constraint = constraint(ConstraintGoal, _, IncompatibleInstVars, _),
     ConstraintGoal = _ - ConstraintGoalInfo,
@@ -627,7 +627,7 @@
     ;
         !:RevIndependent = [Constraint | !.RevIndependent]
     ),
-    filter_dependent_constraints(NonLocals, GoalOutputVars, Constraints,
+    filter_dependent_constraints_2(NonLocals, GoalOutputVars, Constraints,
         !RevDependent, !RevIndependent).
 
 %-----------------------------------------------------------------------------%
@@ -671,39 +671,39 @@
 
 filter_complex_constraints(Constraints,
         SimpleConstraints, ComplexConstraints) :-
-    filter_complex_constraints(Constraints,
+    filter_complex_constraints_2(Constraints,
         [], RevSimpleConstraints, [], RevComplexConstraints),
     SimpleConstraints = list.reverse(RevSimpleConstraints),
     ComplexConstraints = list.reverse(RevComplexConstraints).
 
     % Don't attempt to push branched goals into other goals.
     %
-:- pred filter_complex_constraints(list(constraint)::in,
+:- pred filter_complex_constraints_2(list(constraint)::in,
     list(constraint)::in, list(constraint)::out,
     list(constraint)::in, list(constraint)::out) is det.
 
-filter_complex_constraints([], !RevSimpleConstraints, !RevComplexConstraints).
-filter_complex_constraints([Constraint | Constraints],
+filter_complex_constraints_2([],
+        !RevSimpleConstraints, !RevComplexConstraints).
+filter_complex_constraints_2([Constraint | Constraints],
         !RevSimpleConstraints, !RevComplexConstraints) :-
     Constraint = constraint(ConstraintGoal, _, _, _),
     (
         goal_is_simple(ConstraintGoal),
 
-        %
         % Check whether this simple constraint can be reordered
         % with the complex constraints we've already found.
-        %
-        \+ (
-            list.member(ComplexConstraint, !.RevComplexConstraints),
-            \+ can_reorder_constraints(ComplexConstraint, Constraint)
+        (
+            list.member(ComplexConstraint, !.RevComplexConstraints)
+        =>
+            can_reorder_constraints(ComplexConstraint, Constraint)
         )
     ->
         !:RevSimpleConstraints = [Constraint | !.RevSimpleConstraints]
     ;
         !:RevComplexConstraints = [Constraint | !.RevComplexConstraints]
     ),
-    filter_complex_constraints(Constraints, !RevSimpleConstraints,
-        !RevComplexConstraints).
+    filter_complex_constraints_2(Constraints,
+        !RevSimpleConstraints, !RevComplexConstraints).
 
 :- pred goal_is_simple(hlds_goal::in) is semidet.
 
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.78
diff -u -b -r1.78 continuation_info.m
--- compiler/continuation_info.m	22 Aug 2006 05:03:41 -0000	1.78
+++ compiler/continuation_info.m	19 Sep 2006 14:30:58 -0000
@@ -557,7 +557,7 @@
     pred_info_get_arg_types(PredInfo, ArgTypes),
     some [Type] (
         list.member(Type, ArgTypes),
-        type_is_higher_order(Type, _, _, _, _)
+        type_is_higher_order(Type)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -725,7 +725,7 @@
         LldsInst = llds_inst_partial(Inst)
     ),
     LiveValueType = live_value_var(Var, Name, Type, LldsInst),
-    prog_type.vars(Type, TypeVars).
+    type_vars(Type, TypeVars).
 
 %---------------------------------------------------------------------------%
 
@@ -764,7 +764,7 @@
     Layout = closure_arg_info(Type, Inst),
     set.singleton_set(Locations, reg(reg_r, ArgLoc)),
     svmap.det_insert(Var, Locations, !VarLocs),
-    prog_type.vars(Type, VarTypeVars),
+    type_vars(Type, VarTypeVars),
     svset.insert_list(VarTypeVars, !TypeVars),
     build_closure_info(Vars, Types, ArgInfos, Layouts, InstMap,
         !VarLocs, !TypeVars).
@@ -823,7 +823,7 @@
         [ArgLayout | ArgLayouts], !TypeVars) :-
     map.lookup(VarTypes, Var, Type),
     ArgLayout = table_arg_info(Var, SlotNum, Type),
-    prog_type.vars(Type, VarTypeVars),
+    type_vars(Type, VarTypeVars),
     svset.insert_list(VarTypeVars, !TypeVars),
     build_table_arg_info(VarTypes, NumberedVars, ArgLayouts, !TypeVars).
 
Index: compiler/det_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_util.m,v
retrieving revision 1.39
diff -u -b -r1.39 det_util.m
--- compiler/det_util.m	20 Aug 2006 08:20:59 -0000	1.39
+++ compiler/det_util.m	19 Sep 2006 12:47:00 -0000
@@ -114,11 +114,11 @@
     ).
 
 interpret_unify(X, rhs_var(Y), !Subst) :-
-    term.unify(variable(X), variable(Y), !Subst).
+    unify_term(variable(X), variable(Y), !Subst).
 interpret_unify(X, rhs_functor(ConsId, _, ArgVars), !Subst) :-
     term.var_list_to_term_list(ArgVars, ArgTerms),
     cons_id_and_args_to_term(ConsId, ArgTerms, RhsTerm),
-    term.unify(variable(X), RhsTerm, !Subst).
+    unify_term(variable(X), RhsTerm, !Subst).
 interpret_unify(_X, rhs_lambda_goal(_, _, _, _, _, _, _, _), !Subst).
     % For ease of implementation we just ignore unifications with lambda terms.
     % This is a safe approximation, it just prevents us from optimizing them
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.68
diff -u -b -r1.68 equiv_type.m
--- compiler/equiv_type.m	7 Sep 2006 05:50:53 -0000	1.68
+++ compiler/equiv_type.m	19 Sep 2006 14:31:13 -0000
@@ -856,7 +856,7 @@
         MaybeWithType0 = yes(WithType0),
         replace_in_type(EqvMap, WithType0, WithType, _, !TypeVarSet, !Info),
         (
-            type_is_higher_order(WithType, _Purity, PredOrFunc,
+            type_is_higher_order_details(WithType, _Purity, PredOrFunc,
                 _EvalMethod, ExtraTypes0)
         ->
             ExtraTypes = ExtraTypes0,
Index: compiler/equiv_type_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type_hlds.m,v
retrieving revision 1.37
diff -u -b -r1.37 equiv_type_hlds.m
--- compiler/equiv_type_hlds.m	20 Aug 2006 08:20:59 -0000	1.37
+++ compiler/equiv_type_hlds.m	19 Sep 2006 13:50:39 -0000
@@ -844,7 +844,7 @@
         ;
             unexpected(this_file, "replace_in_goal_expr: info not found")
         ),
-        polymorphism.make_type_info_var(TypeInfoType,
+        polymorphism_make_type_info_var(TypeInfoType,
             term.context_init, TypeInfoVar, Goals0, PolyInfo0, PolyInfo),
         poly_info_extract(PolyInfo, PredInfo0, PredInfo,
             !.Info ^ proc_info, ProcInfo, ModuleInfo),
Index: compiler/frameopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/frameopt.m,v
retrieving revision 1.104
diff -u -b -r1.104 frameopt.m
--- compiler/frameopt.m	22 Aug 2006 05:03:44 -0000	1.104
+++ compiler/frameopt.m	19 Sep 2006 13:18:17 -0000
@@ -2051,7 +2051,7 @@
             % This can happen if fulljump optimization has redirected the
             % return.
             Comments = [comment("exit side labels "
-                ++ dump_labels(ProcLabel, SideLabels)) - ""]
+                ++ dump_labels_for_proc(ProcLabel, SideLabels)) - ""]
         ),
         PrevNeedsFrame = prev_block_needs_frame(OrdNeedsFrame, BlockInfo0),
         ( Type = exit_block(ExitInfo) ->
@@ -2221,18 +2221,19 @@
         SideLabels, MaybeFallThrough, Type),
     expect(unify(Label, BlockLabel), this_file,
         "describe_block: label mismatch"),
-    LabelStr = dump_label(ProcLabel, Label),
+    LabelStr = dump_label_for_proc(ProcLabel, Label),
     BlockInstrsStr = dump_fullinstrs(ProcLabel, yes, BlockInstrs),
     Heading = "\nBLOCK " ++ LabelStr ++ "\n\n",
     ( map.search(PredMap, Label, PredLabel) ->
-        PredStr = "previous label " ++ dump_label(ProcLabel, PredLabel) ++ "\n"
+        PredStr = "previous label " ++
+            dump_label_for_proc(ProcLabel, PredLabel) ++ "\n"
     ;
         PredStr = "no previous label\n"
     ),
     (
         FallInto = yes(FallIntoFromLabel),
-        FallIntoStr = "fallen into from "
-            ++ dump_label(ProcLabel, FallIntoFromLabel) ++ "\n"
+        FallIntoStr = "fallen into from " ++
+            dump_label_for_proc(ProcLabel, FallIntoFromLabel) ++ "\n"
     ;
         FallInto = no,
         FallIntoStr = "not fallen into\n"
@@ -2242,12 +2243,13 @@
         SideStr = "no side labels\n"
     ;
         SideLabels = [_ | _],
-        SideStr = "side labels " ++ dump_labels(ProcLabel, SideLabels) ++ "\n"
+        SideStr = "side labels " ++
+            dump_labels_for_proc(ProcLabel, SideLabels) ++ "\n"
     ),
     (
         MaybeFallThrough = yes(FallThroughLabel),
-        FallThroughStr = "falls through to "
-            ++ dump_label(ProcLabel, FallThroughLabel) ++ "\n"
+        FallThroughStr = "falls through to " ++
+            dump_label_for_proc(ProcLabel, FallThroughLabel) ++ "\n"
     ;
         MaybeFallThrough = no,
         FallThroughStr = "does not fall through\n"
@@ -2364,20 +2366,20 @@
 :- func describe_reason(proc_label, needs_frame_reason) = string.
 
 describe_reason(ProcLabel, code_needs_frame(Label)) =
-    "code " ++ dump_label(ProcLabel, Label).
+    "code " ++ dump_label_for_proc(ProcLabel, Label).
 describe_reason(_ProcLabel, keep_frame) = "keep_frame".
 describe_reason(_ProcLabel, redoip_label) = "redoip_label".
 describe_reason(ProcLabel, frontier(Label, Reasons)) =
-    "frontier(" ++ dump_label(ProcLabel, Label) ++ ", {"
+    "frontier(" ++ dump_label_for_proc(ProcLabel, Label) ++ ", {"
         ++ describe_reasons(ProcLabel, to_sorted_list(Reasons)) ++ "})".
 describe_reason(ProcLabel, jump_around(Label, Reasons)) =
-    "jump_around(" ++ dump_label(ProcLabel, Label) ++ ", {"
+    "jump_around(" ++ dump_label_for_proc(ProcLabel, Label) ++ ", {"
         ++ describe_reasons(ProcLabel, to_sorted_list(Reasons)) ++ "})".
 describe_reason(ProcLabel, succ_propagated(Label, Reason)) =
-    "successor(" ++ dump_label(ProcLabel, Label) ++ ", "
+    "successor(" ++ dump_label_for_proc(ProcLabel, Label) ++ ", "
         ++ describe_reason(ProcLabel, Reason) ++ ")".
 describe_reason(ProcLabel, pred_propagated(Label, Reason)) =
-    "predecessor(" ++ dump_label(ProcLabel, Label) ++ ", "
+    "predecessor(" ++ dump_label_for_proc(ProcLabel, Label) ++ ", "
         ++ describe_reason(ProcLabel, Reason) ++ ")".
 
 :- func describe_reasons(proc_label, list(needs_frame_reason)) = string.
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.137
diff -u -b -r1.137 goal_util.m
--- compiler/goal_util.m	5 Sep 2006 06:21:25 -0000	1.137
+++ compiler/goal_util.m	19 Sep 2006 14:29:42 -0000
@@ -966,7 +966,7 @@
         %
     set.to_sorted_list(NonLocals, NonLocalsList),
     map.apply_to_list(NonLocalsList, VarTypes, NonLocalsTypes),
-    prog_type.vars_list(NonLocalsTypes, NonLocalTypeVarsList0),
+    type_vars_list(NonLocalsTypes, NonLocalTypeVarsList0),
     list.append(ExistQVars, NonLocalTypeVarsList0, NonLocalTypeVarsList),
     set.list_to_set(NonLocalTypeVarsList, NonLocalTypeVars),
 
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.160
diff -u -b -r1.160 higher_order.m
--- compiler/higher_order.m	22 Aug 2006 05:03:46 -0000	1.160
+++ compiler/higher_order.m	19 Sep 2006 14:31:35 -0000
@@ -915,7 +915,7 @@
             InstanceDefn = hlds_instance_defn(_, _, _,
                 InstanceConstraints, InstanceTypes0, _,
                 yes(ClassInterface), _, _),
-            prog_type.vars_list(InstanceTypes0, InstanceTvars),
+            type_vars_list(InstanceTypes0, InstanceTvars),
             get_unconstrained_tvars(InstanceTvars,
                 InstanceConstraints, UnconstrainedTVars),
             NumArgsToExtract = list.length(InstanceConstraints)
@@ -1029,7 +1029,7 @@
         InstanceTypes),
     apply_variable_renaming_to_prog_constraint_list(Renaming, Constraints0,
         Constraints1),
-    prog_type.vars_list(InstanceTypes, InstanceTVars),
+    type_vars_list(InstanceTypes, InstanceTVars),
     get_unconstrained_tvars(InstanceTVars, Constraints1, UnconstrainedTVars0),
 
     type_list_subsumes(InstanceTypes, ClassTypes, Subst),
@@ -1231,7 +1231,7 @@
         map.contains(NewPreds, PredProcId),
         proc_info_get_vartypes(ProcInfo0, VarTypes0),
         map.lookup(VarTypes0, LVar, LVarType),
-        type_is_higher_order(LVarType, _, _, _, ArgTypes)
+        type_is_higher_order_details(LVarType, _, _, _, ArgTypes)
     ->
         % Create variables to represent
         proc_info_create_vars_from_types(ArgTypes, UncurriedArgs,
@@ -1658,7 +1658,7 @@
     ProcInfo = Info ^ proc_info,
     proc_info_get_vartypes(ProcInfo, VarTypes),
     map.apply_to_list(Args, VarTypes, ArgTypes),
-    prog_type.vars_list(ArgTypes, AllTVars),
+    type_vars_list(ArgTypes, AllTVars),
     (
         AllTVars = [],
         ExtraTypeInfoTVars = []
@@ -1705,7 +1705,7 @@
     create_poly_info(!.Info ^ global_info ^ module_info,
         !.Info ^ pred_info, !.Info ^ proc_info, PolyInfo0),
     term.context_init(Context),
-    polymorphism.make_type_info_vars(Types, Context,
+    polymorphism_make_type_info_vars(Types, Context,
         TypeInfoVars, TypeInfoGoals, PolyInfo0, PolyInfo),
     poly_info_extract(PolyInfo, !.Info ^ pred_info, PredInfo,
         !.Info ^ proc_info, ProcInfo, ModuleInfo),
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.210
diff -u -b -r1.210 hlds_pred.m
--- compiler/hlds_pred.m	7 Sep 2006 05:50:55 -0000	1.210
+++ compiler/hlds_pred.m	19 Sep 2006 14:30:06 -0000
@@ -1021,7 +1021,7 @@
         ClassProofs, ClassConstraintMap, ClausesInfo, PredInfo) :-
     PredName = unqualify_name(SymName),
     sym_name_get_module_name(SymName, ModuleName, PredModuleName),
-    prog_type.vars_list(ArgTypes, TVars),
+    type_vars_list(ArgTypes, TVars),
     list.delete_elems(TVars, ExistQVars, HeadTypeParams),
     Attributes = [],
     % XXX kind inference:
@@ -1049,7 +1049,7 @@
     Attributes = [],
     map.init(ClassProofs),
     map.init(ClassConstraintMap),
-    prog_type.vars_list(ArgTypes, TVars),
+    type_vars_list(ArgTypes, TVars),
     list.delete_elems(TVars, ExistQVars, HeadTypeParams),
     % XXX kind inference:
     % we assume all tvars have kind `star'.
@@ -1455,7 +1455,7 @@
 
 pred_info_get_univ_quant_tvars(PredInfo, UnivQVars) :-
     pred_info_get_arg_types(PredInfo, ArgTypes),
-    prog_type.vars_list(ArgTypes, ArgTypeVars0),
+    type_vars_list(ArgTypes, ArgTypeVars0),
     list.sort_and_remove_dups(ArgTypeVars0, ArgTypeVars),
     pred_info_get_exist_quant_tvars(PredInfo, ExistQVars),
     list.delete_elems(ArgTypeVars, ExistQVars, UnivQVars).
Index: compiler/hlds_rtti.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_rtti.m,v
retrieving revision 1.9
diff -u -b -r1.9 hlds_rtti.m
--- compiler/hlds_rtti.m	16 Sep 2006 10:46:39 -0000	1.9
+++ compiler/hlds_rtti.m	19 Sep 2006 14:30:15 -0000
@@ -680,7 +680,7 @@
 get_typeinfo_vars_2([], _, _, []).
 get_typeinfo_vars_2([Var | Vars], VarTypes, TVarMap, TypeInfoVars) :-
     ( map.search(VarTypes, Var, Type) ->
-        prog_type.vars(Type, TypeVars),
+        type_vars(Type, TypeVars),
         (
             TypeVars = [],
             % Optimize common case,
Index: compiler/ilasm.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.48
diff -u -b -r1.48 ilasm.m
--- compiler/ilasm.m	31 Jul 2006 08:31:42 -0000	1.48
+++ compiler/ilasm.m	19 Sep 2006 15:22:20 -0000
@@ -1909,7 +1909,7 @@
 output_comment_string(Comment, !IO) :-
     io.write_string("// ", !IO),
     CommentDoc = separated(text, line,
-        string.words((pred('\n'::in) is semidet :- true), Comment)),
+        string.words_separator((pred('\n'::in) is semidet :- true), Comment)),
     Doc = label("\t// ", CommentDoc),
     write(70, Doc, !IO).
 
Index: compiler/interval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/interval.m,v
retrieving revision 1.21
diff -u -b -r1.21 interval.m
--- compiler/interval.m	16 Sep 2006 10:46:39 -0000	1.21
+++ compiler/interval.m	19 Sep 2006 13:15:18 -0000
@@ -1209,16 +1209,16 @@
     list.condense([StartIds, EndIds, VarsIds, SuccIds], IntervalIds0),
     list.sort_and_remove_dups(IntervalIds0, IntervalIds),
     io.write_string("INTERVALS:\n", !IO),
-    list.foldl(dump_interval_info(IntervalInfo), IntervalIds, !IO),
+    list.foldl(dump_interval_info_id(IntervalInfo), IntervalIds, !IO),
 
     map.to_assoc_list(IntervalInfo ^ anchor_follow_map, AnchorFollows),
     io.write_string("\nANCHOR FOLLOW:\n", !IO),
     list.foldl(dump_anchor_follow, AnchorFollows, !IO).
 
-:- pred dump_interval_info(interval_info::in, interval_id::in, io::di, io::uo)
-    is det.
+:- pred dump_interval_info_id(interval_info::in, interval_id::in,
+    io::di, io::uo) is det.
 
-dump_interval_info(IntervalInfo, IntervalId, !IO) :-
+dump_interval_info_id(IntervalInfo, IntervalId, !IO) :-
     io.write_string("\ninterval ", !IO),
     io.write_int(interval_id_to_int(IntervalId), !IO),
     io.write_string(": ", !IO),
Index: compiler/labelopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/labelopt.m,v
retrieving revision 1.32
diff -u -b -r1.32 labelopt.m
--- compiler/labelopt.m	22 Aug 2006 05:03:49 -0000	1.32
+++ compiler/labelopt.m	19 Sep 2006 13:24:52 -0000
@@ -115,7 +115,7 @@
             !:RevInstrs = [Instr0 | !.RevInstrs],
             !:Fallthrough = yes
         ;
-            eliminate(Instr0, yes(!.Fallthrough), !RevInstrs, !Mod)
+            eliminate_instr(Instr0, yes(!.Fallthrough), !RevInstrs, !Mod)
         )
     ;
         (
@@ -123,7 +123,7 @@
             !:RevInstrs = [Instr0 | !.RevInstrs]
         ;
             !.Fallthrough = no,
-            eliminate(Instr0, no, !RevInstrs, !Mod)
+            eliminate_instr(Instr0, no, !RevInstrs, !Mod)
         ),
         opt_util.can_instr_fall_through(Uinstr0, Canfallthrough),
         (
@@ -140,11 +140,11 @@
     % on the instruction is often enough to deduce what the eliminated
     % instruction was.
     %
-:- pred eliminate(instruction::in, maybe(bool)::in,
+:- pred eliminate_instr(instruction::in, maybe(bool)::in,
     list(instruction)::in, list(instruction)::out,
     bool::in, bool::out) is det.
 
-eliminate(Uinstr0 - Comment0, Label, !RevInstrs, !Mod) :-
+eliminate_instr(Uinstr0 - Comment0, Label, !RevInstrs, !Mod) :-
     labelopt_eliminate_total(Total),
     (
         Total = yes,
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.121
diff -u -b -r1.121 lambda.m
--- compiler/lambda.m	22 Aug 2006 05:03:49 -0000	1.121
+++ compiler/lambda.m	19 Sep 2006 14:31:51 -0000
@@ -316,7 +316,7 @@
     % quantified constraints.
     rtti_varmaps_reusable_constraints(RttiVarMaps, AllConstraints),
     map.apply_to_list(Vars, VarTypes, LambdaVarTypes),
-    list.map(prog_type.vars, LambdaVarTypes, LambdaTypeVarsList),
+    list.map(type_vars, LambdaVarTypes, LambdaTypeVarsList),
     list.condense(LambdaTypeVarsList, LambdaTypeVars),
     list.filter(constraint_contains_vars(LambdaTypeVars),
         AllConstraints, UnivConstraints),
@@ -527,7 +527,7 @@
 
 constraint_contains_vars(LambdaVars, ClassConstraint) :-
     ClassConstraint = constraint(_, ConstraintTypes),
-    list.map(prog_type.vars, ConstraintTypes, ConstraintVarsList),
+    list.map(type_vars, ConstraintTypes, ConstraintVarsList),
     list.condense(ConstraintVarsList, ConstraintVars),
     % Probably not the most efficient way of doing it, but I wouldn't think
     % that it matters.
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.403
diff -u -b -r1.403 mercury_compile.m
--- compiler/mercury_compile.m	15 Sep 2006 11:14:34 -0000	1.403
+++ compiler/mercury_compile.m	19 Sep 2006 13:39:50 -0000
@@ -3411,7 +3411,7 @@
                 "% Transforming polymorphic unifications...\n", !IO)
         ),
         maybe_flush_output(Verbose, !IO),
-        polymorphism.process_module(!HLDS, !IO),
+        polymorphism_process_module(!HLDS, !IO),
         (
             VeryVerbose = no,
             maybe_write_string(Verbose, " done.\n", !IO)
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.302
diff -u -b -r1.302 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	10 Sep 2006 23:39:03 -0000	1.302
+++ compiler/mercury_to_mercury.m	19 Sep 2006 12:06:20 -0000
@@ -3156,31 +3156,10 @@
         add_string(mercury_escape_char(Char), !U)
     ).
 
-:- func mercury_escape_char(char) = string.
-
-    % Convert a character to the corresponding octal escape code.
-    %
-    % We use ISO-Prolog style octal escapes, which are of the form
-    % '\nnn\'; note that unlike C octal escapes, they are terminated
-    % with a backslash.
-    %
-    % Note: the code here is similar to code in
-    % library/term_io.m; any changes here
-    % may require similar changes there.
-
-mercury_escape_char(Char) = EscapeCode :-
-    % XXX This may cause problems interfacing with versions of the compiler
-    % that have been built in grades which use different character
-    % representations.
-    char.to_int(Char, Int),
-    string.int_to_base_string(Int, 8, OctalString0),
-    string.pad_left(OctalString0, '0', 3, OctalString),
-    EscapeCode = "\\" ++ OctalString ++ "\\".
-
-:- pred mercury_is_source_char(char::in) is semidet.
-
     % Succeed if Char is a character which is allowed in
     % Mercury string and character literals.
+    %
+:- pred mercury_is_source_char(char::in) is semidet.
 
 mercury_is_source_char(Char) :-
     ( char.is_alnum(Char)
@@ -3189,45 +3168,6 @@
     ; Char = '\t'
     ).
 
-    % Currently we only allow the following characters.
-    % XXX should we just use is_printable(Char) instead?
-
-:- pred is_mercury_punctuation_char(char::in) is semidet.
-
-is_mercury_punctuation_char(' ').
-is_mercury_punctuation_char('!').
-is_mercury_punctuation_char('@').
-is_mercury_punctuation_char('#').
-is_mercury_punctuation_char('$').
-is_mercury_punctuation_char('%').
-is_mercury_punctuation_char('^').
-is_mercury_punctuation_char('&').
-is_mercury_punctuation_char('*').
-is_mercury_punctuation_char('(').
-is_mercury_punctuation_char(')').
-is_mercury_punctuation_char('-').
-is_mercury_punctuation_char('_').
-is_mercury_punctuation_char('+').
-is_mercury_punctuation_char('=').
-is_mercury_punctuation_char('`').
-is_mercury_punctuation_char('~').
-is_mercury_punctuation_char('{').
-is_mercury_punctuation_char('}').
-is_mercury_punctuation_char('[').
-is_mercury_punctuation_char(']').
-is_mercury_punctuation_char(';').
-is_mercury_punctuation_char(':').
-is_mercury_punctuation_char('''').
-is_mercury_punctuation_char('"').
-is_mercury_punctuation_char('<').
-is_mercury_punctuation_char('>').
-is_mercury_punctuation_char('.').
-is_mercury_punctuation_char(',').
-is_mercury_punctuation_char('/').
-is_mercury_punctuation_char('?').
-is_mercury_punctuation_char('\\').
-is_mercury_punctuation_char('|').
-
 %-----------------------------------------------------------------------------%
 
     % escape_special_char(Char, EscapeChar)
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.116
diff -u -b -r1.116 ml_code_util.m
--- compiler/ml_code_util.m	7 Sep 2006 05:50:58 -0000	1.116
+++ compiler/ml_code_util.m	19 Sep 2006 13:50:25 -0000
@@ -2145,7 +2145,7 @@
 
     % Call polymorphism.m to generate the HLDS code to create the type_infos.
     create_poly_info(ModuleInfo0, PredInfo0, ProcInfo0, PolyInfo0),
-    polymorphism.make_type_info_var(Type, Context,
+    polymorphism_make_type_info_var(Type, Context,
         TypeInfoVar, TypeInfoGoals, PolyInfo0, PolyInfo),
     poly_info_extract(PolyInfo, PredInfo0, PredInfo,
         ProcInfo0, ProcInfo, ModuleInfo1),
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.169
diff -u -b -r1.169 mlds_to_il.m
--- compiler/mlds_to_il.m	22 Aug 2006 05:03:58 -0000	1.169
+++ compiler/mlds_to_il.m	19 Sep 2006 15:22:47 -0000
@@ -262,7 +262,7 @@
     io_lookup_string_option(dotnet_library_version, VersionStr, !IO),
     IsSep = (pred(('.')::in) is semidet),
     (
-        string.words(IsSep, VersionStr) = [Mj, Mn, Bu, Rv],
+        string.words_separator(IsSep, VersionStr) = [Mj, Mn, Bu, Rv],
         string.to_int(Mj, Major),
         string.to_int(Mn, Minor),
         string.to_int(Bu, Build),
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.191
diff -u -b -r1.191 mode_util.m
--- compiler/mode_util.m	22 Aug 2006 05:03:59 -0000	1.191
+++ compiler/mode_util.m	19 Sep 2006 14:24:29 -0000
@@ -592,7 +592,7 @@
         )
     ;
         Inst0 = ground(Uniq, none),
-        ( type_is_higher_order(Type, _Purity, function, _, ArgTypes) ->
+        ( type_is_higher_order_details(Type, _Purity, function, _, ArgTypes) ->
             default_higher_order_func_inst(ModuleInfo, ArgTypes,
                 HigherOrderInstInfo),
             Inst = ground(Uniq, higher_order(HigherOrderInstInfo))
@@ -606,7 +606,7 @@
         Inst0 = ground(Uniq, higher_order(PredInstInfo0)),
         PredInstInfo0 = pred_inst_info(PredOrFunc, Modes0, Det),
         (
-            type_is_higher_order(Type, _Purity, PredOrFunc, _, ArgTypes),
+            type_is_higher_order_details(Type, _, PredOrFunc, _, ArgTypes),
             list.same_length(ArgTypes, Modes0)
         ->
             propagate_types_into_mode_list(ModuleInfo, ArgTypes, Modes0, Modes)
@@ -668,7 +668,7 @@
     ;
         Inst0 = ground(Uniq, none),
         apply_type_subst(Type0, Subst, Type),
-        ( type_is_higher_order(Type, _Purity, function, _, ArgTypes) ->
+        ( type_is_higher_order_details(Type, _, function, _, ArgTypes) ->
             default_higher_order_func_inst(ModuleInfo, ArgTypes,
                 HigherOrderInstInfo),
             Inst = ground(Uniq, higher_order(HigherOrderInstInfo))
@@ -684,7 +684,7 @@
         PredInstInfo0 = pred_inst_info(PredOrFunc, Modes0, Det),
         apply_type_subst(Type0, Subst, Type),
         (
-            type_is_higher_order(Type, _Purity, PredOrFunc, _, ArgTypes),
+            type_is_higher_order_details(Type, _, PredOrFunc, _, ArgTypes),
             list.same_length(ArgTypes, Modes0)
         ->
             propagate_types_into_mode_list(ModuleInfo, ArgTypes, Modes0, Modes)
Index: compiler/modecheck_call.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modecheck_call.m,v
retrieving revision 1.74
diff -u -b -r1.74 modecheck_call.m
--- compiler/modecheck_call.m	5 Sep 2006 06:21:28 -0000	1.74
+++ compiler/modecheck_call.m	19 Sep 2006 14:24:37 -0000
@@ -232,7 +232,7 @@
             GroundInstInfo = none,
             mode_info_get_var_types(!.ModeInfo, VarTypes),
             map.lookup(VarTypes, PredVar, Type),
-            type_is_higher_order(Type, _Purity, function, _, ArgTypes),
+            type_is_higher_order_details(Type, _Purity, function, _, ArgTypes),
             PredInstInfo = pred_inst_info_standard_func_mode(
                 list.length(ArgTypes))
         ),
Index: compiler/modecheck_unify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.110
diff -u -b -r1.110 modecheck_unify.m
--- compiler/modecheck_unify.m	5 Sep 2006 06:21:28 -0000	1.110
+++ compiler/modecheck_unify.m	19 Sep 2006 14:24:56 -0000
@@ -241,7 +241,8 @@
     %
     (
         % Check if variable has a higher-order type.
-        type_is_higher_order(TypeOfX, Purity, _, EvalMethod, PredArgTypes),
+        type_is_higher_order_details(TypeOfX, Purity, _, EvalMethod,
+            PredArgTypes),
         ConsId0 = pred_const(ShroudedPredProcId, _)
     ->
         % Convert the pred term to a lambda expression.
@@ -885,7 +886,7 @@
     % and to the unification.
     %
     ( Goal0 = unify(X, Y, Mode, Unification0, FinalUnifyContext) ->
-        polymorphism.unification_typeinfos(Type, RttiVarMaps,
+        unification_typeinfos_rtti_varmaps(Type, RttiVarMaps,
             Unification0, Unification, GoalInfo2, GoalInfo),
         Goal = unify(X, Y, Mode, Unification, FinalUnifyContext)
     ;
@@ -1104,7 +1105,7 @@
     ;
 
         % Check that we're not trying to do a higher-order unification.
-        type_is_higher_order(Type, _, PredOrFunc, _, _)
+        type_is_higher_order_details(Type, _, PredOrFunc, _, _)
     ->
         % We do not want to report this as an error if it occurs in a
         % compiler-generated predicate - instead, we delay the error
@@ -1300,7 +1301,7 @@
             CanFail = can_fail,
             mode_info_get_instmap(!.ModeInfo, InstMap0),
             (
-                type_is_higher_order(TypeOfX, _, PredOrFunc, _, _),
+                type_is_higher_order_details(TypeOfX, _, PredOrFunc, _, _),
                 instmap.is_reachable(InstMap0)
             ->
                 set.init(WaitingVars),
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.344
diff -u -b -r1.344 modes.m
--- compiler/modes.m	10 Sep 2006 23:39:03 -0000	1.344
+++ compiler/modes.m	19 Sep 2006 13:35:32 -0000
@@ -548,10 +548,9 @@
 copy_pred_body(OldPredTable, PredId, PredTable0, PredTable) :-
     map.lookup(PredTable0, PredId, PredInfo0),
     (
-        % don't copy type class methods, because their
-        % proc_infos are generated already mode-correct,
-        % and because copying from the clauses_info doesn't
-        % work for them.
+        % Don't copy type class methods, because their proc_infos are generated
+        % already mode-correct, and because copying from the clauses_info
+        % doesn't work for them.
         pred_info_get_markers(PredInfo0, Markers),
         check_marker(Markers, marker_class_method)
     ->
@@ -3239,7 +3238,7 @@
 
     % Do the transformation for this call goal.
     SymName = qualified(CalleeModuleName, CalleePredName),
-    polymorphism.process_new_call(CalleePredInfo, CalleeProcInfo,
+    polymorphism_process_new_call(CalleePredInfo, CalleeProcInfo,
         CalleePredId, CalleeProcId, ArgVars, not_builtin, CallUnifyContext,
         SymName, GoalInfo, Goal, PolyInfo0, PolyInfo),
 
Index: compiler/name_mangle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/name_mangle.m,v
retrieving revision 1.20
diff -u -b -r1.20 name_mangle.m
--- compiler/name_mangle.m	8 Jun 2006 08:19:25 -0000	1.20
+++ compiler/name_mangle.m	19 Sep 2006 15:17:48 -0000
@@ -236,7 +236,7 @@
     ).
 
 name_doesnt_need_mangling(Name) :-
-    string.is_alnum_or_underscore(Name),
+    string.is_all_alnum_or_underscore(Name),
     \+ string.append("f_", _Suffix, Name).
 
 sym_name_doesnt_need_mangling(unqualified(Name)) :-
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.175
diff -u -b -r1.175 opt_debug.m
--- compiler/opt_debug.m	4 Sep 2006 01:47:33 -0000	1.175
+++ compiler/opt_debug.m	19 Sep 2006 13:21:58 -0000
@@ -41,11 +41,12 @@
 
 :- func dump_livemap(livemap) = string.
 
-:- func dump_livemap(proc_label, livemap) = string.
+:- func dump_livemap_for_proc(proc_label, livemap) = string.
 
 :- func dump_livemaplist(assoc_list(label, lvalset)) = string.
 
-:- func dump_livemaplist(proc_label, assoc_list(label, lvalset)) = string.
+:- func dump_livemaplist_for_proc(proc_label, assoc_list(label, lvalset))
+    = string.
 
 :- func dump_livevals(lvalset) = string.
 
@@ -85,11 +86,11 @@
 
 :- func dump_label(label) = string.
 
-:- func dump_label(proc_label, label) = string.
+:- func dump_label_for_proc(proc_label, label) = string.
 
 :- func dump_labels(list(label)) = string.
 
-:- func dump_labels(proc_label, list(label)) = string.
+:- func dump_labels_for_proc(proc_label, list(label)) = string.
 
 :- func dump_label_pairs(list(pair(label))) = string.
 
@@ -99,11 +100,11 @@
 
 :- func dump_code_addr(code_addr) = string.
 
-:- func dump_code_addr(proc_label, code_addr) = string.
+:- func dump_code_addr_for_proc(proc_label, code_addr) = string.
 
 :- func dump_code_addrs(list(code_addr)) = string.
 
-:- func dump_code_addrs(proc_label, list(code_addr)) = string.
+:- func dump_code_addrs_for_proc(proc_label, list(code_addr)) = string.
 
 :- func dump_bool(bool) = string.
 
@@ -208,18 +209,19 @@
 dump_livemap(Livemap) =
     dump_livemaplist(map.to_assoc_list(Livemap)).
 
-dump_livemap(ProcLabel, Livemap) =
-    dump_livemaplist(ProcLabel, map.to_assoc_list(Livemap)).
+dump_livemap_for_proc(ProcLabel, Livemap) =
+    dump_livemaplist_for_proc(ProcLabel, map.to_assoc_list(Livemap)).
 
 dump_livemaplist([]) = "".
 dump_livemaplist([Label - Lvalset | Livemaplist]) =
     dump_label(Label) ++ " ->" ++ dump_livevals(Lvalset) ++ "\n"
         ++ dump_livemaplist(Livemaplist).
 
-dump_livemaplist(_ProcLabel, []) = "".
-dump_livemaplist(ProcLabel, [Label - Lvalset | Livemaplist]) =
-    dump_label(ProcLabel, Label) ++ " ->" ++ dump_livevals(Lvalset) ++ "\n"
-        ++ dump_livemaplist(ProcLabel, Livemaplist).
+dump_livemaplist_for_proc(_ProcLabel, []) = "".
+dump_livemaplist_for_proc(ProcLabel, [Label - Lvalset | Livemaplist]) =
+    dump_label_for_proc(ProcLabel, Label) ++ " ->" ++
+        dump_livevals(Lvalset) ++ "\n" ++
+        dump_livemaplist_for_proc(ProcLabel, Livemaplist).
 
 dump_livevals(Lvalset) =
     dump_livelist(set.to_sorted_list(Lvalset)).
@@ -542,9 +544,9 @@
     "do_call_class_method_" ++ ho_call_variant_to_string(Variant).
 dump_code_addr(do_not_reached) = "do_not_reached".
 
-dump_code_addr(ProcLabel, CodeAddr) =
+dump_code_addr_for_proc(ProcLabel, CodeAddr) =
     ( CodeAddr = label(Label) ->
-        dump_label(ProcLabel, Label)
+        dump_label_for_proc(ProcLabel, Label)
     ;
         dump_code_addr(CodeAddr)
     ).
@@ -553,24 +555,24 @@
 dump_code_addrs([Addr | Addrs]) =
     " " ++ dump_code_addr(Addr) ++ dump_code_addrs(Addrs).
 
-dump_code_addrs(_, []) = "".
-dump_code_addrs(ProcLabel, [Addr | Addrs]) =
-    " " ++ dump_code_addr(ProcLabel, Addr)
-        ++ dump_code_addrs(ProcLabel, Addrs).
+dump_code_addrs_for_proc(_, []) = "".
+dump_code_addrs_for_proc(ProcLabel, [Addr | Addrs]) =
+    " " ++ dump_code_addr_for_proc(ProcLabel, Addr) ++
+        dump_code_addrs_for_proc(ProcLabel, Addrs).
 
 dump_label(internal(N, ProcLabel)) =
     dump_proclabel(ProcLabel) ++ "_i" ++ int_to_string(N).
 dump_label(entry(_, ProcLabel)) =
     dump_proclabel(ProcLabel).
 
-dump_label(CurProcLabel, internal(N, ProcLabel)) = Str :-
+dump_label_for_proc(CurProcLabel, internal(N, ProcLabel)) = Str :-
     string.int_to_string(N, N_str),
     ( CurProcLabel = ProcLabel ->
         Str = "local_" ++ N_str
     ;
         Str = dump_proclabel(ProcLabel) ++ "_" ++ N_str
     ).
-dump_label(CurProcLabel, entry(_, ProcLabel)) = Str :-
+dump_label_for_proc(CurProcLabel, entry(_, ProcLabel)) = Str :-
     ( CurProcLabel = ProcLabel ->
         Str = "CUR_PROC_ENTRY"
     ;
@@ -581,9 +583,10 @@
 dump_labels([Label | Labels]) =
     " " ++ dump_label(Label) ++ dump_labels(Labels).
 
-dump_labels(_, []) = "".
-dump_labels(ProcLabel, [Label | Labels]) =
-    " " ++ dump_label(ProcLabel, Label) ++ dump_labels(ProcLabel, Labels).
+dump_labels_for_proc(_, []) = "".
+dump_labels_for_proc(ProcLabel, [Label | Labels]) =
+    " " ++ dump_label_for_proc(ProcLabel, Label) ++
+        dump_labels_for_proc(ProcLabel, Labels).
 
 dump_label_pairs([]) = "".
 dump_label_pairs([L1 - L2 | Labels]) =
@@ -659,14 +662,14 @@
             CallModel = call_model_nondet(unchecked_tail_call),
             CallModelStr = "nondet unchecked_tail_call"
         ),
-        Str = "call(" ++ dump_code_addr(ProcLabel, Callee) ++ ", "
-            ++ dump_code_addr(ProcLabel, ReturnLabel) ++ ", ..., "
+        Str = "call(" ++ dump_code_addr_for_proc(ProcLabel, Callee) ++ ", "
+            ++ dump_code_addr_for_proc(ProcLabel, ReturnLabel) ++ ", ..., "
             ++ CallModelStr ++ ")"
     ;
         Instr = mkframe(FrameInfo, MaybeRedoip),
         (
             MaybeRedoip = yes(Redoip),
-            R_str = dump_code_addr(ProcLabel, Redoip)
+            R_str = dump_code_addr_for_proc(ProcLabel, Redoip)
         ;
             MaybeRedoip = no,
             R_str = "no_redoip"
@@ -694,21 +697,21 @@
         )
     ;
         Instr = label(Label),
-        Str = dump_label(ProcLabel, Label) ++ ":"
+        Str = dump_label_for_proc(ProcLabel, Label) ++ ":"
     ;
         Instr = goto(CodeAddr),
-        Str = "goto " ++ dump_code_addr(ProcLabel, CodeAddr)
+        Str = "goto " ++ dump_code_addr_for_proc(ProcLabel, CodeAddr)
     ;
         Instr = computed_goto(Rval, Labels),
         Str = "computed_goto " ++ dump_rval(Rval) ++ ":"
-            ++ dump_labels(ProcLabel, Labels)
+            ++ dump_labels_for_proc(ProcLabel, Labels)
     ;
         Instr = arbitrary_c_code(Code, _),
         Str = "arbitrary_c_code(" ++ Code ++ ")"
     ;
         Instr = if_val(Rval, CodeAddr),
         Str = "if (" ++ dump_rval(Rval) ++ ") goto "
-            ++ dump_code_addr(ProcLabel, CodeAddr)
+            ++ dump_code_addr_for_proc(ProcLabel, CodeAddr)
     ;
         Instr = save_maxfr(Lval),
         Str = "save_maxfr(" ++ dump_lval(Lval) ++ ")"
@@ -776,8 +779,8 @@
             ++ int_to_string(N) ++")"
     ;
         Instr = fork(Child, Parent, NumSlots),
-        Str = "fork(" ++ dump_label(ProcLabel, Child) ++ ", "
-            ++ dump_label(ProcLabel, Parent) ++ ", "
+        Str = "fork(" ++ dump_label_for_proc(ProcLabel, Child) ++ ", "
+            ++ dump_label_for_proc(ProcLabel, Parent) ++ ", "
             ++ int_to_string(NumSlots) ++ ")"
     ;
         Instr = join_and_terminate(Lval),
@@ -785,17 +788,17 @@
     ;
         Instr = join_and_continue(Lval, Label),
         Str = "join(" ++ dump_lval(Lval) ++ ", "
-            ++ dump_label(ProcLabel, Label) ++ ")"
+            ++ dump_label_for_proc(ProcLabel, Label) ++ ")"
     ;
         Instr = pragma_c(Decls, Comps, MCM, MFNL, MFL, MFOL, MNF, SSR, MD),
         Str = "pragma_c(\n"
             ++ "declarations:\n" ++ dump_decls(Decls)
             ++ "components:\n" ++ dump_components(ProcLabel, Comps)
             ++ dump_may_call_mercury(MCM) ++ "\n"
-            ++ dump_maybe_label("fix nolayout:", ProcLabel, MFNL)
-            ++ dump_maybe_label("fix layout:", ProcLabel, MFL)
-            ++ dump_maybe_label("fix onlylayout:", ProcLabel, MFOL)
-            ++ dump_maybe_label("nofix:", ProcLabel, MNF)
+            ++ dump_maybe_label_for_proc("fix nolayout:", ProcLabel, MFNL)
+            ++ dump_maybe_label_for_proc("fix layout:", ProcLabel, MFL)
+            ++ dump_maybe_label_for_proc("fix onlylayout:", ProcLabel, MFOL)
+            ++ dump_maybe_label_for_proc("nofix:", ProcLabel, MNF)
             ++ dump_bool("stack slot ref:", SSR)
             ++ dump_bool("may duplicate:", MD)
             ++ ")"
@@ -806,11 +809,11 @@
 dump_may_call_mercury(proc_may_call_mercury) = "may_call_mercury".
 dump_may_call_mercury(proc_will_not_call_mercury) = "will_not_call_mercury".
 
-:- func dump_maybe_label(string, proc_label, maybe(label)) = string.
+:- func dump_maybe_label_for_proc(string, proc_label, maybe(label)) = string.
 
-dump_maybe_label(_Msg, _ProcLabel, no) = "".
-dump_maybe_label(Msg, ProcLabel, yes(Label)) =
-    Msg ++ " " ++ dump_label(ProcLabel, Label) ++ "\n".
+dump_maybe_label_for_proc(_Msg, _ProcLabel, no) = "".
+dump_maybe_label_for_proc(Msg, ProcLabel, yes(Label)) =
+    Msg ++ " " ++ dump_label_for_proc(ProcLabel, Label) ++ "\n".
 
 :- func dump_bool(string, bool) = string.
 
@@ -848,7 +851,7 @@
 dump_component(_, pragma_c_user_code(_, Code)) = Code ++ "\n".
 dump_component(_, pragma_c_raw_code(Code, _, _)) = Code ++ "\n".
 dump_component(ProcLabel, pragma_c_fail_to(Label)) =
-    "fail to " ++ dump_label(ProcLabel, Label) ++ "\n".
+    "fail to " ++ dump_label_for_proc(ProcLabel, Label) ++ "\n".
 dump_component(_, pragma_c_noop) = "".
 
 :- func dump_input_components(list(pragma_c_input)) = string.
Index: compiler/ordering_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ordering_mode_constraints.m,v
retrieving revision 1.9
diff -u -b -r1.9 ordering_mode_constraints.m
--- compiler/ordering_mode_constraints.m	27 Jul 2006 05:01:17 -0000	1.9
+++ compiler/ordering_mode_constraints.m	19 Sep 2006 13:02:32 -0000
@@ -256,7 +256,8 @@
     pred_info_proc_info(!.PredInfo, ProcId, ProcInfo0),
     proc_info_get_goal(ProcInfo0, Goal0),
 
-    ConstraintFormulae = pred_constraints_to_formulae(ProcId, PredConstraints),
+    ConstraintFormulae =
+        pred_constraints_for_proc_to_formulae(ProcId, PredConstraints),
 
     PrepConstraints0 = new_prep_cstrts,
     prepare_abstract_constraints(ConstraintFormulae, PrepConstraints0,
@@ -556,7 +557,7 @@
         % Variable not produced here - no constraints.
     ;
         ProgVarAtProducers = [RepVar],      % Should be only one producer
-        First = get_position_in_conj(RepVar),
+        get_position_in_conj(RepVar, First),
         list.map(get_position_in_conj, ProgVarAtConsumers, Laters),
 
         list.foldl(add_lt_constraint(First), Laters, !OCInfo)
@@ -572,20 +573,13 @@
 produced_at_path(VarMap, Bindings, RepVar) :-
     map.lookup(Bindings, bimap.lookup(VarMap, RepVar)) = yes.
 
-    % get_position_in_conj(RepVar) fails if the deepest level of the
-    % goalpath in RepVar is not a conjunction, otherwise it returns
+    % get_position_in_conj(RepVar, N) fails if the deepest level of the
+    % goalpath in RepVar is not a conjunction, otherwise it returns in N
     % the number of the conjunct the RepVar refers to.
     %
-:- func get_position_in_conj(mc_rep_var::in) = (conjunct_id::out) is semidet.
-
-get_position_in_conj(_ProgVar `in` _PredId `at` [conj(N) | _]) = N.
-
-    % Predicate version of get_position_in_conj
-    %
 :- pred get_position_in_conj(mc_rep_var::in, conjunct_id::out) is semidet.
 
-get_position_in_conj(RepVar, ConjID) :-
-    ConjID = get_position_in_conj(RepVar).
+get_position_in_conj(_ProgVar `in` _PredId `at` [conj(N) | _], N).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.306
diff -u -b -r1.306 polymorphism.m
--- compiler/polymorphism.m	7 Sep 2006 05:51:02 -0000	1.306
+++ compiler/polymorphism.m	19 Sep 2006 14:26:01 -0000
@@ -190,8 +190,8 @@
 
     % Run the polymorphism pass over the whole HLDS.
     %
-:- pred process_module(module_info::in, module_info::out, io::di, io::uo)
-    is det.
+:- pred polymorphism_process_module(module_info::in, module_info::out,
+    io::di, io::uo) is det.
 
     % Run the polymorphism pass over a single pred. This is used to transform
     % clauses introduced by unify_proc.m for complicated unification predicates
@@ -204,13 +204,13 @@
     % any polymorphic predicates which require type_infos or typeclass_infos
     % to be added to the argument list.
     %
-:- pred process_generated_pred(pred_id::in, module_info::in, module_info::out)
-    is det.
+:- pred polymorphism_process_generated_pred(pred_id::in,
+    module_info::in, module_info::out) is det.
 
     % Add the type_info variables for a complicated unification to
     % the appropriate fields in the unification and the goal_info.
     %
-:- pred unification_typeinfos(mer_type::in, rtti_varmaps::in,
+:- pred unification_typeinfos_rtti_varmaps(mer_type::in, rtti_varmaps::in,
     unification::in, unification::out, hlds_goal_info::in, hlds_goal_info::out)
     is det.
 
@@ -221,7 +221,7 @@
     % XXX This predicate does not yet handle calls whose arguments include
     % existentially quantified types or type class constraints.
     %
-:- pred process_new_call(pred_info::in, proc_info::in,
+:- pred polymorphism_process_new_call(pred_info::in, proc_info::in,
     pred_id::in, proc_id::in, list(prog_var)::in, builtin_state::in,
     maybe(call_unify_context)::in, sym_name::in, hlds_goal_info::in,
     hlds_goal::out, poly_info::in, poly_info::out) is det.
@@ -231,14 +231,14 @@
     % variables to the appropriate type_info structures for the types.
     % Update the varset and vartypes accordingly.
     %
-:- pred make_type_info_vars(list(mer_type)::in, term.context::in,
+:- pred polymorphism_make_type_info_vars(list(mer_type)::in, term.context::in,
     list(prog_var)::out, list(hlds_goal)::out, poly_info::in, poly_info::out)
     is det.
 
     % Likewise, but for a single type.
     %
-:- pred make_type_info_var(mer_type::in, term.context::in, prog_var::out,
-    list(hlds_goal)::out, poly_info::in, poly_info::out) is det.
+:- pred polymorphism_make_type_info_var(mer_type::in, term.context::in,
+    prog_var::out, list(hlds_goal)::out, poly_info::in, poly_info::out) is det.
 
     % gen_extract_type_info(TypeVar, Kind, TypeClassInfoVar,
     %   Index, ModuleInfo, Goals, TypeInfoVar, ...):
@@ -422,19 +422,19 @@
 % looks at the argtypes of the called predicates, and so we need to make
 % sure we don't muck them up before we've finished the first pass.
 
-process_module(!ModuleInfo, !IO) :-
+polymorphism_process_module(!ModuleInfo, !IO) :-
     module_info_preds(!.ModuleInfo, Preds0),
     map.keys(Preds0, PredIds0),
-    list.foldl2(maybe_process_pred, PredIds0, !ModuleInfo, !IO),
+    list.foldl2(maybe_polymorphism_process_pred, PredIds0, !ModuleInfo, !IO),
     module_info_preds(!.ModuleInfo, Preds1),
     map.keys(Preds1, PredIds1),
-    list.foldl(fixup_pred, PredIds1, !ModuleInfo),
+    list.foldl(fixup_pred_polymorphism, PredIds1, !ModuleInfo),
     expand_class_method_bodies(!ModuleInfo).
 
-:- pred maybe_process_pred(pred_id::in,
+:- pred maybe_polymorphism_process_pred(pred_id::in,
     module_info::in, module_info::out, io::di, io::uo) is det.
 
-maybe_process_pred(PredId, !ModuleInfo, !IO) :-
+maybe_polymorphism_process_pred(PredId, !ModuleInfo, !IO) :-
     module_info_pred_info(!.ModuleInfo, PredId, PredInfo),
     (
         PredModule = pred_info_module(PredInfo),
@@ -445,15 +445,15 @@
         % Just copy the clauses to the proc_infos.
         copy_module_clauses_to_procs([PredId], !ModuleInfo)
     ;
-        process_pred(PredId, !ModuleInfo, !IO)
+        polymorphism_process_pred_msg(PredId, !ModuleInfo, !IO)
     ).
 
 %---------------------------------------------------------------------------%
 
-:- pred fixup_pred(pred_id::in,
+:- pred fixup_pred_polymorphism(pred_id::in,
     module_info::in, module_info::out) is det.
 
-fixup_pred(PredId, !ModuleInfo) :-
+fixup_pred_polymorphism(PredId, !ModuleInfo) :-
     % Recompute the arg types by finding the headvars and the var->type mapping
     % (from the clauses_info) and applying the type mapping to the extra
     % headvars to get the new arg types. Note that we are careful to only apply
@@ -475,7 +475,8 @@
         ExtraHeadVars = ExtraHeadVars0,
         OldHeadVars = OldHeadVars0
     ;
-        unexpected(this_file, "fixup_pred: list.split_list failed")
+        unexpected(this_file,
+            "fixup_pred_polymorphism: list.split_list failed")
     ),
 
     map.apply_to_list(ExtraHeadVars, VarTypes0, ExtraArgTypes),
@@ -498,8 +499,8 @@
         \+ map.is_empty(Subn)
     ->
         pred_info_set_existq_tvar_binding(Subn, PredInfo1, PredInfo2),
-        introduce_exists_casts_pred(!.ModuleInfo, Subn, ExtraHeadVars,
-            PredInfo2, PredInfo)
+        polymorphism_introduce_exists_casts_pred(!.ModuleInfo, Subn,
+            ExtraHeadVars, PredInfo2, PredInfo)
     ;
         PredInfo = PredInfo1
     ),
@@ -507,10 +508,11 @@
     map.det_update(PredTable0, PredId, PredInfo, PredTable),
     module_info_set_preds(PredTable, !ModuleInfo).
 
-:- pred introduce_exists_casts_pred(module_info::in, tsubst::in,
+:- pred polymorphism_introduce_exists_casts_pred(module_info::in, tsubst::in,
     list(prog_var)::in, pred_info::in, pred_info::out) is det.
 
-introduce_exists_casts_pred(ModuleInfo, Subn, ExtraHeadVars, !PredInfo) :-
+polymorphism_introduce_exists_casts_pred(ModuleInfo, Subn, ExtraHeadVars,
+        !PredInfo) :-
     % Note that updating the vartypes here, and also below, only needs
     % to be done because type_info/1 and typeclass_info/1 have types
     % appearing in their respective arguments.  When we get rid of those,
@@ -542,22 +544,22 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred process_pred(pred_id::in, module_info::in, module_info::out,
-    io::di, io::uo) is det.
+:- pred polymorphism_process_pred_msg(pred_id::in,
+    module_info::in, module_info::out, io::di, io::uo) is det.
 
-process_pred(PredId, !ModuleInfo, !IO) :-
+polymorphism_process_pred_msg(PredId, !ModuleInfo, !IO) :-
     write_pred_progress_message("% Transforming polymorphism for ",
         PredId, !.ModuleInfo, !IO),
-    process_pred(PredId, !ModuleInfo).
+    polymorphism_process_pred(PredId, !ModuleInfo).
 
-process_generated_pred(PredId, !ModuleInfo) :-
-    process_pred(PredId, !ModuleInfo),
-    fixup_pred(PredId, !ModuleInfo).
+polymorphism_process_generated_pred(PredId, !ModuleInfo) :-
+    polymorphism_process_pred(PredId, !ModuleInfo),
+    fixup_pred_polymorphism(PredId, !ModuleInfo).
 
-:- pred process_pred(pred_id::in,
+:- pred polymorphism_process_pred(pred_id::in,
     module_info::in, module_info::out) is det.
 
-process_pred(PredId, !ModuleInfo) :-
+polymorphism_process_pred(PredId, !ModuleInfo) :-
     module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
 
     % Run the polymorphism pass over the clauses_info, updating the headvars,
@@ -565,7 +567,7 @@
     % poly_info.
 
     pred_info_clauses_info(PredInfo0, ClausesInfo0),
-    process_clause_info(PredInfo0, !.ModuleInfo,
+    polymorphism_process_clause_info(PredInfo0, !.ModuleInfo,
         ClausesInfo0, ClausesInfo, Info, ExtraArgModes),
     poly_info_get_module_info(Info, !:ModuleInfo),
     poly_info_get_typevarset(Info, TypeVarSet),
@@ -578,17 +580,17 @@
 
     ProcIds = pred_info_procids(PredInfo2),
     pred_info_get_procedures(PredInfo2, Procs0),
-    list.foldl(process_proc_in_table(PredInfo2, ClausesInfo,
+    list.foldl(polymorphism_process_proc_in_table(PredInfo2, ClausesInfo,
         ExtraArgModes), ProcIds, Procs0, Procs),
     pred_info_set_procedures(Procs, PredInfo2, PredInfo),
 
     module_info_set_pred_info(PredId, PredInfo, !ModuleInfo).
 
-:- pred process_clause_info(pred_info::in, module_info::in,
+:- pred polymorphism_process_clause_info(pred_info::in, module_info::in,
     clauses_info::in, clauses_info::out, poly_info::out, list(mer_mode)::out)
     is det.
 
-process_clause_info(PredInfo0, ModuleInfo0, !ClausesInfo, !:Info,
+polymorphism_process_clause_info(PredInfo0, ModuleInfo0, !ClausesInfo, !:Info,
         ExtraArgModes) :-
     init_poly_info(ModuleInfo0, PredInfo0, !.ClausesInfo, !:Info),
     clauses_info_get_headvars(!.ClausesInfo, HeadVars0),
@@ -599,7 +601,7 @@
 
     clauses_info_clauses_only(!.ClausesInfo, Clauses0),
     list.map_foldl(
-        process_clause(PredInfo0, HeadVars0, HeadVars,
+        polymorphism_process_clause(PredInfo0, HeadVars0, HeadVars,
             UnconstrainedTVars, ExtraTypeInfoHeadVars,
             ExistTypeClassInfoHeadVars),
         Clauses0, Clauses, !Info),
@@ -615,11 +617,11 @@
         VarTypes, HeadVars, ClausesRep, RttiVarMaps,
         !.ClausesInfo ^ have_foreign_clauses).
 
-:- pred process_clause(pred_info::in, list(prog_var)::in,
+:- pred polymorphism_process_clause(pred_info::in, list(prog_var)::in,
     list(prog_var)::in, list(tvar)::in, list(prog_var)::in, list(prog_var)::in,
     clause::in, clause::out, poly_info::in, poly_info::out) is det.
 
-process_clause(PredInfo0, OldHeadVars, NewHeadVars,
+polymorphism_process_clause(PredInfo0, OldHeadVars, NewHeadVars,
         UnconstrainedTVars, ExtraTypeInfoHeadVars,
         ExistTypeClassInfoHeadVars, !Clause, !Info) :-
     ( pred_info_is_imported(PredInfo0) ->
@@ -627,7 +629,7 @@
     ;
         Goal0 = !.Clause ^ clause_body,
         % Process any polymorphic calls inside the goal.
-        process_goal(Goal0, Goal1, !Info),
+        polymorphism_process_goal(Goal0, Goal1, !Info),
 
         % Generate code to construct the typeclass_infos and type_infos
         % for existentially quantified type vars.
@@ -640,20 +642,20 @@
         !:Clause = !.Clause ^ clause_body := Goal
     ).
 
-:- pred process_proc_in_table(pred_info::in, clauses_info::in,
+:- pred polymorphism_process_proc_in_table(pred_info::in, clauses_info::in,
     list(mer_mode)::in, proc_id::in, proc_table::in, proc_table::out) is det.
 
-process_proc_in_table(PredInfo, ClausesInfo, ExtraArgModes,
+polymorphism_process_proc_in_table(PredInfo, ClausesInfo, ExtraArgModes,
         ProcId, !ProcTable) :-
     map.lookup(!.ProcTable, ProcId, ProcInfo0),
-    process_proc(PredInfo, ClausesInfo, ExtraArgModes, ProcId,
+    polymorphism_process_proc(PredInfo, ClausesInfo, ExtraArgModes, ProcId,
         ProcInfo0, ProcInfo),
     map.det_update(!.ProcTable, ProcId, ProcInfo, !:ProcTable).
 
-:- pred process_proc(pred_info::in, clauses_info::in,
+:- pred polymorphism_process_proc(pred_info::in, clauses_info::in,
     list(mer_mode)::in, proc_id::in, proc_info::in, proc_info::out) is det.
 
-process_proc(PredInfo, ClausesInfo, ExtraArgModes, ProcId,
+polymorphism_process_proc(PredInfo, ClausesInfo, ExtraArgModes, ProcId,
         !ProcInfo) :-
     % Copy all the information from the clauses_info into the proc_info.
     (
@@ -738,7 +740,7 @@
     InstanceMethodConstraints = instance_method_constraints(_,
         InstanceTypes, InstanceConstraints, ClassContext),
 
-    prog_type.vars_list(InstanceTypes, InstanceTVars),
+    type_vars_list(InstanceTypes, InstanceTVars),
     get_unconstrained_tvars(InstanceTVars, InstanceConstraints,
         UnconstrainedInstanceTVars),
     pred_info_get_arg_types(PredInfo, ArgTypeVarSet, _, _),
@@ -822,7 +824,7 @@
     list.append(UnivHeadTypeClassInfoVars, ExistHeadTypeClassInfoVars,
         ExtraHeadTypeClassInfoVars),
 
-    prog_type.vars_list(ArgTypes, HeadTypeVars),
+    type_vars_list(ArgTypes, HeadTypeVars),
     list.delete_elems(HeadTypeVars, UnivConstrainedTVars,
         UnconstrainedTVars0),
     list.delete_elems(UnconstrainedTVars0, ExistConstrainedTVars,
@@ -969,7 +971,7 @@
 
     apply_subst_to_tvar_list(KindMap, PredToActualTypeSubst,
         UnconstrainedTVars, ActualTypes),
-    make_type_info_vars(ActualTypes, Context,
+    polymorphism_make_type_info_vars(ActualTypes, Context,
         TypeInfoVars, ExtraTypeInfoGoals, !Info),
     assign_var_list(TypeInfoHeadVars, TypeInfoVars,
         ExtraTypeInfoUnifyGoals),
@@ -1022,34 +1024,34 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred process_goal(hlds_goal::in, hlds_goal::out,
+:- pred polymorphism_process_goal(hlds_goal::in, hlds_goal::out,
     poly_info::in, poly_info::out) is det.
 
-process_goal(Goal0 - GoalInfo0, Goal, !Info) :-
-    process_goal_expr(Goal0, GoalInfo0, Goal, !Info).
+polymorphism_process_goal(Goal0 - GoalInfo0, Goal, !Info) :-
+    polymorphism_process_goal_expr(Goal0, GoalInfo0, Goal, !Info).
 
-:- pred process_goal_expr(hlds_goal_expr::in, hlds_goal_info::in,
+:- pred polymorphism_process_goal_expr(hlds_goal_expr::in, hlds_goal_info::in,
     hlds_goal::out, poly_info::in, poly_info::out) is det.
 
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     % We don't need to add type_infos for higher order calls, since the
     % type_infos are added when the closures are constructed, not when
     % they are called.
     GoalExpr = generic_call(_, _, _, _),
     Goal = GoalExpr - GoalInfo.
 
-process_goal_expr(Goal0, GoalInfo0, Goal, !Info) :-
+polymorphism_process_goal_expr(Goal0, GoalInfo0, Goal, !Info) :-
     PredId = Goal0 ^ call_pred_id,
     ArgVars0 = Goal0 ^ call_args,
-    process_call(PredId, ArgVars0, GoalInfo0, GoalInfo, ExtraVars, ExtraGoals,
-        !Info),
+    polymorphism_process_call(PredId, ArgVars0, GoalInfo0, GoalInfo,
+        ExtraVars, ExtraGoals, !Info),
     ArgVars = ExtraVars ++ ArgVars0,
     CallExpr = Goal0 ^ call_args := ArgVars,
     Call = CallExpr - GoalInfo,
     list.append(ExtraGoals, [Call], GoalList),
     conj_list_to_goal(GoalList, GoalInfo0, Goal).
 
-process_goal_expr(Goal0, GoalInfo0, Goal, !Info) :-
+polymorphism_process_goal_expr(Goal0, GoalInfo0, Goal, !Info) :-
     Goal0 = call_foreign_proc(_, PredId, _, _, _, _, _),
     poly_info_get_module_info(!.Info, ModuleInfo),
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
@@ -1060,43 +1062,43 @@
     ( no_type_info_builtin(PredModule, PredName, PredArity) ->
         Goal = Goal0 - GoalInfo0
     ;
-        process_foreign_proc(ModuleInfo, PredInfo, Goal0, GoalInfo0, Goal,
-            !Info)
+        polymorphism_process_foreign_proc(ModuleInfo, PredInfo, Goal0,
+            GoalInfo0, Goal, !Info)
     ).
 
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = unify(XVar, Y, Mode, Unification, UnifyContext),
-    process_unify(XVar, Y, Mode, Unification, UnifyContext,
+    polymorphism_process_unify(XVar, Y, Mode, Unification, UnifyContext,
         GoalInfo, Goal, !Info).
 
     % The rest of the clauses just process goals recursively.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = conj(ConjType, Goals0),
-    process_goal_list(Goals0, Goals, !Info),
+    polymorphism_process_goal_list(Goals0, Goals, !Info),
     Goal = conj(ConjType, Goals) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = disj(Goals0),
-    process_goal_list(Goals0, Goals, !Info),
+    polymorphism_process_goal_list(Goals0, Goals, !Info),
     Goal = disj(Goals) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = negation(SubGoal0),
-    process_goal(SubGoal0, SubGoal, !Info),
+    polymorphism_process_goal(SubGoal0, SubGoal, !Info),
     Goal = negation(SubGoal) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = switch(Var, CanFail, Cases0),
-    process_case_list(Cases0, Cases, !Info),
+    polymorphism_process_case_list(Cases0, Cases, !Info),
     Goal = switch(Var, CanFail, Cases) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = scope(Reason, SubGoal0),
-    process_goal(SubGoal0, SubGoal, !Info),
+    polymorphism_process_goal(SubGoal0, SubGoal, !Info),
     Goal = scope(Reason, SubGoal) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = if_then_else(Vars, Cond0, Then0, Else0),
-    process_goal(Cond0, Cond, !Info),
-    process_goal(Then0, Then, !Info),
-    process_goal(Else0, Else, !Info),
+    polymorphism_process_goal(Cond0, Cond, !Info),
+    polymorphism_process_goal(Then0, Then, !Info),
+    polymorphism_process_goal(Else0, Else, !Info),
     Goal = if_then_else(Vars, Cond, Then, Else) - GoalInfo.
-process_goal_expr(GoalExpr, _GoalInfo, _Goal, !Info) :-
+polymorphism_process_goal_expr(GoalExpr, _GoalInfo, _Goal, !Info) :-
     % These should have been expanded out by now.
     GoalExpr = shorthand(_),
     unexpected(this_file, "process_goal_expr: unexpected shorthand").
@@ -1129,12 +1131,12 @@
         String = String0
     ).
 
-:- pred process_unify(prog_var::in, unify_rhs::in,
+:- pred polymorphism_process_unify(prog_var::in, unify_rhs::in,
     unify_mode::in, unification::in, unify_context::in, hlds_goal_info::in,
     hlds_goal::out, poly_info::in, poly_info::out) is det.
 
-process_unify(XVar, Y, Mode, Unification0, UnifyContext, GoalInfo0, Goal,
-        !Info) :-
+polymorphism_process_unify(XVar, Y, Mode, Unification0, UnifyContext,
+        GoalInfo0, Goal, !Info) :-
     (
         Y = rhs_var(_YVar),
 
@@ -1157,14 +1159,14 @@
         Goal = unify(XVar, Y, Mode, Unification, UnifyContext) - GoalInfo
     ;
         Y = rhs_functor(ConsId, _, Args),
-        process_unify_functor(XVar, ConsId, Args, Mode,
+        polymorphism_process_unify_functor(XVar, ConsId, Args, Mode,
             Unification0, UnifyContext, GoalInfo0, Goal, !Info)
     ;
         Y = rhs_lambda_goal(Purity, PredOrFunc, EvalMethod, ArgVars0,
             LambdaVars, Modes, Det, LambdaGoal0),
 
         % For lambda expressions, we must recursively traverse the lambda goal.
-        process_goal(LambdaGoal0, LambdaGoal1, !Info),
+        polymorphism_process_goal(LambdaGoal0, LambdaGoal1, !Info),
         % Currently we don't allow lambda goals to be
         % existentially typed
         ExistQVars = [],
@@ -1191,17 +1193,18 @@
 unification_typeinfos(Type, !Unification, !GoalInfo, !Info) :-
     % Compute the type_info/type_class_info variables that would be used
     % if this unification ends up being a complicated_unify.
-    prog_type.vars(Type, TypeVars),
+    type_vars(Type, TypeVars),
     list.map_foldl(get_type_info_locn, TypeVars, TypeInfoLocns, !Info),
     add_unification_typeinfos(TypeInfoLocns, !Unification, !GoalInfo).
 
-    % This variant is for use by modecheck_unify.m.
-    % During mode checking all the type_infos should appear in
-    % the type_info_varmap.
-unification_typeinfos(Type, RttiVarMaps, !Unification, !GoalInfo) :-
+unification_typeinfos_rtti_varmaps(Type, RttiVarMaps, !Unification,
+        !GoalInfo) :-
+    % This variant is for use by modecheck_unify.m. During mode checking,
+    % all the type_infos should appear in the type_info_varmap.
+
     % Compute the type_info/type_class_info variables that would be used
     % if this unification ends up being a complicated_unify.
-    prog_type.vars(Type, TypeVars),
+    type_vars(Type, TypeVars),
     list.map(rtti_lookup_type_info_locn(RttiVarMaps), TypeVars,
         TypeInfoLocns),
     add_unification_typeinfos(TypeInfoLocns, !Unification, !GoalInfo).
@@ -1233,12 +1236,12 @@
         true
     ).
 
-:- pred process_unify_functor(prog_var::in, cons_id::in,
+:- pred polymorphism_process_unify_functor(prog_var::in, cons_id::in,
     list(prog_var)::in, unify_mode::in, unification::in, unify_context::in,
     hlds_goal_info::in, hlds_goal::out, poly_info::in, poly_info::out) is det.
 
-process_unify_functor(X0, ConsId0, ArgVars0, Mode0, Unification0, UnifyContext,
-        GoalInfo0, Goal, !Info) :-
+polymorphism_process_unify_functor(X0, ConsId0, ArgVars0, Mode0, Unification0,
+        UnifyContext, GoalInfo0, Goal, !Info) :-
     poly_info_get_module_info(!.Info, ModuleInfo0),
     poly_info_get_var_types(!.Info, VarTypes0),
     map.lookup(VarTypes0, X0, TypeOfX),
@@ -1269,7 +1272,7 @@
     %
 
         % Check if variable has a higher order type.
-        type_is_higher_order(TypeOfX, Purity, _PredOrFunc, EvalMethod,
+        type_is_higher_order_details(TypeOfX, Purity, _PredOrFunc, EvalMethod,
             CalleeArgTypes),
         ConsId0 = pred_const(ShroudedPredProcId, _)
     ->
@@ -1282,8 +1285,8 @@
             ModuleInfo0, Functor0, VarSet0, VarSet, VarTypes0, VarTypes),
         poly_info_set_varset_and_types(VarSet, VarTypes, !Info),
         % Process the unification in its new form.
-        process_unify(X0, Functor0, Mode0, Unification0, UnifyContext,
-            GoalInfo0, Goal, !Info)
+        polymorphism_process_unify(X0, Functor0, Mode0, Unification0,
+            UnifyContext, GoalInfo0, Goal, !Info)
     ;
         % Is this a construction or deconstruction of an existentially
         % typed data type?
@@ -1309,7 +1312,7 @@
         % type_info and/or type_class_info variables.
 
         map.apply_to_list(ArgVars0, VarTypes0, ActualArgTypes),
-        process_existq_unify_functor(ConsDefn,
+        polymorphism_process_existq_unify_functor(ConsDefn,
             IsConstruction, ActualArgTypes, TypeOfX, GoalInfo0,
             ExtraVars, ExtraGoals, !Info),
         list.append(ExtraVars, ArgVars0, ArgVars),
@@ -1342,7 +1345,7 @@
         ModuleInfo0, Functor, !VarSet, !VarTypes) :-
 
     % Create the new lambda-quantified variables.
-    make_fresh_vars(PredArgTypes, LambdaVars, !VarSet, !VarTypes),
+    create_fresh_vars(PredArgTypes, LambdaVars, !VarSet, !VarTypes),
     list.append(ArgVars0, LambdaVars, Args),
 
     % Build up the hlds_goal_expr for the call that will form the lambda goal.
@@ -1401,26 +1404,25 @@
     Functor = rhs_lambda_goal(Purity, PredOrFunc, EvalMethod, ArgVars0,
         LambdaVars, LambdaModes, LambdaDet, LambdaGoal).
 
-:- pred make_fresh_vars(list(mer_type)::in, list(prog_var)::out,
-    prog_varset::in, prog_varset::out,
-    vartypes::in, vartypes::out) is det.
+:- pred create_fresh_vars(list(mer_type)::in, list(prog_var)::out,
+    prog_varset::in, prog_varset::out, vartypes::in, vartypes::out) is det.
 
-make_fresh_vars([], [], !VarSet, !VarTypes).
-make_fresh_vars([Type | Types], [Var | Vars], !VarSet, !VarTypes) :-
+create_fresh_vars([], [], !VarSet, !VarTypes).
+create_fresh_vars([Type | Types], [Var | Vars], !VarSet, !VarTypes) :-
     varset.new_var(!.VarSet, Var, !:VarSet),
     map.det_insert(!.VarTypes, Var, Type, !:VarTypes),
-    make_fresh_vars(Types, Vars, !VarSet, !VarTypes).
+    create_fresh_vars(Types, Vars, !VarSet, !VarTypes).
 
 %-----------------------------------------------------------------------------%
 
     % Compute the extra arguments that we need to add to a unification with
     % an existentially quantified data constructor.
     %
-:- pred process_existq_unify_functor(ctor_defn::in, bool::in,
+:- pred polymorphism_process_existq_unify_functor(ctor_defn::in, bool::in,
     list(mer_type)::in, mer_type::in, hlds_goal_info::in, list(prog_var)::out,
     list(hlds_goal)::out, poly_info::in, poly_info::out) is det.
 
-process_existq_unify_functor(CtorDefn, IsConstruction,
+polymorphism_process_existq_unify_functor(CtorDefn, IsConstruction,
         ActualArgTypes, ActualRetType, GoalInfo,
         ExtraVars, ExtraGoals, !Info) :-
     CtorDefn = ctor_defn(CtorTypeVarSet, CtorExistQVars, CtorKindMap,
@@ -1480,7 +1482,7 @@
 
     % Create type_info variables for the _unconstrained_ existentially
     % quantified type variables.
-    make_type_info_vars(ActualExistentialTypes, Context,
+    polymorphism_make_type_info_vars(ActualExistentialTypes, Context,
         ExtraTypeInfoVars, ExtraTypeInfoGoals, !Info),
 
     % The type_class_info variables go AFTER the type_info variables
@@ -1492,19 +1494,20 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred process_foreign_proc(module_info::in, pred_info::in,
+:- pred polymorphism_process_foreign_proc(module_info::in, pred_info::in,
     hlds_goal_expr::in(bound(call_foreign_proc(ground,ground,ground,ground,
     ground,ground,ground))), hlds_goal_info::in, hlds_goal::out,
     poly_info::in, poly_info::out) is det.
 
-process_foreign_proc(ModuleInfo, PredInfo, Goal0, GoalInfo0, Goal, !Info) :-
+polymorphism_process_foreign_proc(ModuleInfo, PredInfo, Goal0, GoalInfo0, Goal,
+        !Info) :-
     % Insert the type_info vars into the argname map, so that the foreign_proc
     % can refer to the type_info variable for type T as `TypeInfo_for_T'.
     Goal0 = call_foreign_proc(Attributes, PredId, ProcId, Args0, ProcExtraArgs,
         MaybeTraceRuntimeCond, Impl0),
     ArgVars0 = list.map(foreign_arg_var, Args0),
-    process_call(PredId, ArgVars0, GoalInfo0, GoalInfo, ExtraVars, ExtraGoals,
-        !Info),
+    polymorphism_process_call(PredId, ArgVars0, GoalInfo0, GoalInfo,
+        ExtraVars, ExtraGoals, !Info),
     ( Impl0 = fc_impl_import(_, _, _, _) ->
         % The reference manual guarantees a one-to-one correspondence between
         % the arguments of the predicate (as augmented by with type_info and/or
@@ -1514,8 +1517,8 @@
     ;
         CanOptAwayUnnamed = yes
     ),
-    process_foreign_proc_args(PredInfo, CanOptAwayUnnamed, Impl0, ExtraVars,
-        ExtraArgs),
+    polymorphism_process_foreign_proc_args(PredInfo, CanOptAwayUnnamed, Impl0,
+        ExtraVars, ExtraArgs),
     Args = ExtraArgs ++ Args0,
 
     % Add the type info arguments to the list of variables
@@ -1534,12 +1537,14 @@
     list.append(ExtraGoals, [Call], GoalList),
     conj_list_to_goal(GoalList, GoalInfo0, Goal).
 
-:- pred process_foreign_proc_args(pred_info::in, bool::in,
+:- pred polymorphism_process_foreign_proc_args(pred_info::in, bool::in,
     pragma_foreign_code_impl::in, list(prog_var)::in, list(foreign_arg)::out)
     is det.
 
-process_foreign_proc_args(PredInfo, CanOptAwayUnnamed, Impl, Vars, Args) :-
-    pred_info_get_arg_types(PredInfo, PredTypeVarSet, ExistQVars, PredArgTypes),
+polymorphism_process_foreign_proc_args(PredInfo, CanOptAwayUnnamed, Impl, Vars,
+        Args) :-
+    pred_info_get_arg_types(PredInfo, PredTypeVarSet, ExistQVars,
+        PredArgTypes),
 
     % Find out which variables are constrained (so that we don't add
     % type_infos for them.
@@ -1549,7 +1554,7 @@
     ExistVars0 = list.map(get_constrained_vars, ExistCs),
     list.condense(ExistVars0, ExistConstrainedVars),
 
-    prog_type.vars_list(PredArgTypes, PredTypeVars0),
+    type_vars_list(PredArgTypes, PredTypeVars0),
     list.remove_dups(PredTypeVars0, PredTypeVars1),
     list.delete_elems(PredTypeVars1, UnivConstrainedVars, PredTypeVars2),
     list.delete_elems(PredTypeVars2, ExistConstrainedVars, PredTypeVars),
@@ -1599,7 +1604,7 @@
         Constraint, MaybeArgName - native_if_possible) :-
     Constraint = constraint(Name0, Types),
     sym_name_to_string(Name0, "__", Name),
-    prog_type.vars_list(Types, TypeVars),
+    type_vars_list(Types, TypeVars),
     TypeVarNames = list.map(underscore_and_tvar_name(TypeVarSet), TypeVars),
     string.append_list(["TypeClassInfo_for_", Name | TypeVarNames],
         ConstraintVarName),
@@ -1652,23 +1657,23 @@
     varset.lookup_name(TypeVarSet, TVar, TVarName0),
     string.append("_", TVarName0, TVarName).
 
-:- pred process_goal_list(list(hlds_goal)::in,
+:- pred polymorphism_process_goal_list(list(hlds_goal)::in,
     list(hlds_goal)::out, poly_info::in, poly_info::out) is det.
 
-process_goal_list([], [], !Info).
-process_goal_list([Goal0 | Goals0], [Goal | Goals], !Info) :-
-    process_goal(Goal0, Goal, !Info),
-    process_goal_list(Goals0, Goals, !Info).
+polymorphism_process_goal_list([], [], !Info).
+polymorphism_process_goal_list([Goal0 | Goals0], [Goal | Goals], !Info) :-
+    polymorphism_process_goal(Goal0, Goal, !Info),
+    polymorphism_process_goal_list(Goals0, Goals, !Info).
 
-:- pred process_case_list(list(case)::in, list(case)::out,
+:- pred polymorphism_process_case_list(list(case)::in, list(case)::out,
     poly_info::in, poly_info::out) is det.
 
-process_case_list([], [], !Info).
-process_case_list([Case0 | Cases0], [Case | Cases], !Info) :-
+polymorphism_process_case_list([], [], !Info).
+polymorphism_process_case_list([Case0 | Cases0], [Case | Cases], !Info) :-
     Case0 = case(ConsId, Goal0),
-    process_goal(Goal0, Goal, !Info),
+    polymorphism_process_goal(Goal0, Goal, !Info),
     Case = case(ConsId, Goal),
-    process_case_list(Cases0, Cases, !Info).
+    polymorphism_process_case_list(Cases0, Cases, !Info).
 
 %-----------------------------------------------------------------------------%
 
@@ -1678,13 +1683,13 @@
     % existential/universal type_infos and type_class_infos
     % in a more consistent manner.
     %
-:- pred process_call(pred_id::in, list(prog_var)::in,
+:- pred polymorphism_process_call(pred_id::in, list(prog_var)::in,
     hlds_goal_info::in, hlds_goal_info::out,
     list(prog_var)::out, list(hlds_goal)::out,
     poly_info::in, poly_info::out) is det.
 
-process_call(PredId, ArgVars0, GoalInfo0, GoalInfo, ExtraVars, ExtraGoals,
-        !Info) :-
+polymorphism_process_call(PredId, ArgVars0, GoalInfo0, GoalInfo,
+        ExtraVars, ExtraGoals, !Info) :-
     poly_info_get_var_types(!.Info, VarTypes),
     poly_info_get_typevarset(!.Info, TypeVarSet0),
     poly_info_get_module_info(!.Info, ModuleInfo),
@@ -1723,7 +1728,7 @@
             PredToParentTypeRenaming),
         apply_variable_renaming_to_type_list(PredToParentTypeRenaming,
             PredArgTypes, ParentArgTypes),
-        prog_type.vars_list(ParentArgTypes, ParentTVars),
+        type_vars_list(ParentArgTypes, ParentTVars),
         apply_variable_renaming_to_tvar_kind_map(PredToParentTypeRenaming,
             PredKindMap, ParentKindMap),
         apply_variable_renaming_to_tvar_list(PredToParentTypeRenaming,
@@ -1811,15 +1816,15 @@
         % vars.
         apply_rec_subst_to_tvar_list(ParentKindMap, ParentToActualTypeSubst,
             ParentUnconstrainedUnivTVars, ActualUnconstrainedUnivTypes),
-        make_type_info_vars(ActualUnconstrainedUnivTypes, Context,
-            ExtraUnivTypeInfoVars, ExtraUnivTypeInfoGoals, !Info),
+        polymorphism_make_type_info_vars(ActualUnconstrainedUnivTypes,
+            Context, ExtraUnivTypeInfoVars, ExtraUnivTypeInfoGoals, !Info),
 
         % Make variables to hold typeinfos for unconstrained existential type
         % vars.
         apply_rec_subst_to_tvar_list(ParentKindMap, ParentToActualTypeSubst,
             ParentUnconstrainedExistTVars, ActualUnconstrainedExistTypes),
-        make_type_info_vars(ActualUnconstrainedExistTypes, Context,
-            ExtraExistTypeInfoVars, ExtraExistTypeInfoGoals, !Info),
+        polymorphism_make_type_info_vars(ActualUnconstrainedExistTypes,
+            Context, ExtraExistTypeInfoVars, ExtraExistTypeInfoGoals, !Info),
 
         % Add up the extra vars and goals.
         ExtraGoals = ExtraUnivClassGoals ++ ExtraExistClassGoals
@@ -1840,9 +1845,9 @@
     % XXX This predicate does not yet handle calls whose arguments include
     % existentially quantified types or type class constraints.
     %
-process_new_call(CalleePredInfo, CalleeProcInfo, PredId, ProcId, CallArgs0,
-        BuiltinState, MaybeCallUnifyContext, SymName, GoalInfo0, Goal,
-        !Info) :-
+polymorphism_process_new_call(CalleePredInfo, CalleeProcInfo, PredId, ProcId,
+        CallArgs0, BuiltinState, MaybeCallUnifyContext, SymName,
+        GoalInfo0, Goal, !Info) :-
     poly_info_get_typevarset(!.Info, TVarSet0),
     poly_info_get_var_types(!.Info, VarTypes0),
     ActualArgTypes0 = map.apply_to_list(CallArgs0, VarTypes0),
@@ -1862,7 +1867,8 @@
         OrigPredArgTypes = OrigPredArgTypes0,
         CalleeExtraHeadVars = CalleeExtraHeadVars0
     ;
-        unexpected(this_file, "process_new_call: extra args not found")
+        unexpected(this_file,
+            "polymorphism_process_new_call: extra args not found")
     ),
 
     % Work out the bindings of type variables in the call.
@@ -1899,8 +1905,8 @@
 
     % Construct goals to make the required type_infos.
     Ctxt = term.context_init,
-    make_type_info_vars(ActualTypeInfoTypes, Ctxt, ExtraArgs, ExtraGoals,
-        !Info),
+    polymorphism_make_type_info_vars(ActualTypeInfoTypes, Ctxt,
+        ExtraArgs, ExtraGoals, !Info),
     CallArgs = ExtraArgs ++ CallArgs0,
     goal_info_get_nonlocals(GoalInfo0, NonLocals0),
     NonLocals1 = set.list_to_set(ExtraArgs),
@@ -2114,7 +2120,7 @@
     % we assume all tvars have kind `star'.
     map.init(KindMap),
 
-    prog_type.vars_list(InstanceTypes0, InstanceTvars),
+    type_vars_list(InstanceTypes0, InstanceTvars),
     get_unconstrained_tvars(InstanceTvars, InstanceConstraints0,
         UnconstrainedTvars0),
 
@@ -2149,7 +2155,7 @@
 
     % Make the type_infos for the types that are constrained by this.
     % These are packaged in the typeclass_info.
-    make_type_info_vars(ConstrainedTypes, Context,
+    polymorphism_make_type_info_vars(ConstrainedTypes, Context,
         InstanceExtraTypeInfoVars, TypeInfoGoals, !Info),
 
     % Make the typeclass_infos for the constraints from the context of the
@@ -2159,7 +2165,7 @@
 
     % Make the type_infos for the unconstrained type variables from the head
     % of the instance declaration.
-    make_type_info_vars(UnconstrainedTypes, Context,
+    polymorphism_make_type_info_vars(UnconstrainedTypes, Context,
         InstanceExtraTypeInfoUnconstrainedVars,
         UnconstrainedTypeInfoGoals, !Info),
 
@@ -2411,7 +2417,7 @@
 
     constraint_list_get_tvars(ExistentialConstraints, TVars0),
     list.sort_and_remove_dups(TVars0, TVars),
-    list.foldl2(maybe_extract_type_info(OldRttiVarMaps), TVars,
+    list.foldl2(polymorphism_maybe_extract_type_info(OldRttiVarMaps), TVars,
         [], ExtraGoals, !Info).
 
     % For code which requires mode reordering, we may have already seen uses
@@ -2421,11 +2427,12 @@
     % and the type_info is contained in a typeclass_info, we need to generate
     % code to extract it here.
     %
-:- pred maybe_extract_type_info(rtti_varmaps::in, tvar::in,
+:- pred polymorphism_maybe_extract_type_info(rtti_varmaps::in, tvar::in,
     list(hlds_goal)::in, list(hlds_goal)::out, poly_info::in, poly_info::out)
     is det.
 
-maybe_extract_type_info(OldRttiVarMaps, TVar, !ExtraGoals, !Info) :-
+polymorphism_maybe_extract_type_info(OldRttiVarMaps, TVar, !ExtraGoals,
+        !Info) :-
     poly_info_get_rtti_varmaps(!.Info, RttiVarMaps),
     (
         rtti_search_type_info_locn(OldRttiVarMaps, TVar,
@@ -2433,7 +2440,7 @@
         rtti_search_type_info_locn(RttiVarMaps, TVar,
             typeclass_info(TypeClassInfoVar, Index))
     ->
-        extract_type_info(TVar, TypeClassInfoVar, Index, NewGoals,
+        polymorphism_extract_type_info(TVar, TypeClassInfoVar, Index, NewGoals,
             TypeInfoVar1, !Info),
         assign_var(TypeInfoVar0, TypeInfoVar1, AssignGoal),
         !:ExtraGoals = NewGoals ++ [AssignGoal | !.ExtraGoals]
@@ -2443,14 +2450,16 @@
 
 %---------------------------------------------------------------------------%
 
-make_type_info_vars([], _, [], [], !Info).
-make_type_info_vars([Type | Types], Context, ExtraVars, ExtraGoals, !Info) :-
-    make_type_info_var(Type, Context, Var, ExtraGoals1, !Info),
-    make_type_info_vars(Types, Context, ExtraVars2, ExtraGoals2, !Info),
+polymorphism_make_type_info_vars([], _, [], [], !Info).
+polymorphism_make_type_info_vars([Type | Types], Context,
+        ExtraVars, ExtraGoals, !Info) :-
+    polymorphism_make_type_info_var(Type, Context, Var, ExtraGoals1, !Info),
+    polymorphism_make_type_info_vars(Types, Context, ExtraVars2, ExtraGoals2,
+        !Info),
     ExtraVars = [Var | ExtraVars2],
     ExtraGoals = ExtraGoals1 ++ ExtraGoals2.
 
-make_type_info_var(Type, Context, Var, ExtraGoals, !Info) :-
+polymorphism_make_type_info_var(Type, Context, Var, ExtraGoals, !Info) :-
     % First handle statically known types (i.e. types which are not
     % type variables).
     ( type_has_variable_arity_ctor(Type, TypeCtor, TypeArgs) ->
@@ -2465,14 +2474,14 @@
         % XXX FIXME (RTTI for higher order impure code)
         % we should not ignore the purity of higher order procs;
         % it should get included in the RTTI.
-        construct_type_info(Type, TypeCtor, TypeArgs, yes, Context, Var,
-            ExtraGoals, !Info)
+        polymorphism_construct_type_info(Type, TypeCtor, TypeArgs, yes,
+            Context, Var, ExtraGoals, !Info)
     ; type_to_ctor_and_args(Type, TypeCtor, TypeArgs) ->
         % This occurs for code where a predicate calls a polymorphic predicate
         % with a known value of the type variable. The transformation we
         % perform is shown in the comment at the top of the module.
-        construct_type_info(Type, TypeCtor, TypeArgs, no, Context, Var,
-            ExtraGoals, !Info)
+        polymorphism_construct_type_info(Type, TypeCtor, TypeArgs, no,
+            Context, Var, ExtraGoals, !Info)
     ;
         % Now handle the cases of types which are not known statically
         % (i.e. type variables)
@@ -2516,14 +2525,14 @@
         poly_info_set_rtti_varmaps(RttiVarMaps, !Info)
     ).
 
-:- pred construct_type_info(mer_type::in, type_ctor::in,
+:- pred polymorphism_construct_type_info(mer_type::in, type_ctor::in,
     list(mer_type)::in, bool::in, prog_context::in, prog_var::out,
     list(hlds_goal)::out, poly_info::in, poly_info::out) is det.
 
-construct_type_info(Type, TypeCtor, TypeArgs, TypeCtorIsVarArity, Context, Var,
-        ExtraGoals, !Info) :-
+polymorphism_construct_type_info(Type, TypeCtor, TypeArgs, TypeCtorIsVarArity,
+        Context, Var, ExtraGoals, !Info) :-
     % Create the typeinfo vars for the arguments.
-    make_type_info_vars(TypeArgs, Context,
+    polymorphism_make_type_info_vars(TypeArgs, Context,
         ArgTypeInfoVars, ArgTypeInfoGoals, !Info),
 
     poly_info_get_varset(!.Info, VarSet0),
@@ -2835,15 +2844,15 @@
         % If the typeinfo is in a typeclass_info, then we need to extract it
         % before using it
         TypeInfoLocn = typeclass_info(TypeClassInfoVar, Index),
-        extract_type_info(TypeVar, TypeClassInfoVar, Index, ExtraGoals, Var,
-            !Info)
+        polymorphism_extract_type_info(TypeVar, TypeClassInfoVar, Index,
+            ExtraGoals, Var, !Info)
     ).
 
-:- pred extract_type_info(tvar::in, prog_var::in, int::in,
+:- pred polymorphism_extract_type_info(tvar::in, prog_var::in, int::in,
     list(hlds_goal)::out, prog_var::out, poly_info::in, poly_info::out) is det.
 
-extract_type_info(TypeVar, TypeClassInfoVar, Index, Goals, TypeInfoVar,
-        !Info) :-
+polymorphism_extract_type_info(TypeVar, TypeClassInfoVar, Index, Goals,
+        TypeInfoVar, !Info) :-
     poly_info_get_varset(!.Info, VarSet0),
     poly_info_get_var_types(!.Info, VarTypes0),
     poly_info_get_rtti_varmaps(!.Info, RttiVarMaps0),
@@ -2940,7 +2949,7 @@
 
     % The first type_info will be just after the superclass infos.
     First = NumSuperClasses + 1,
-    prog_type.vars_list(ClassTypes, ClassTypeVars0),
+    type_vars_list(ClassTypes, ClassTypeVars0),
     list.map_foldl(make_index, ClassTypeVars0, ClassTypeVars, First, _),
 
     % Work out which type variables we haven't seen before, or which we
@@ -3211,7 +3220,7 @@
 
 get_constrained_vars(Constraint) = CVars :-
     Constraint = constraint(_, CTypes),
-    prog_type.vars_list(CTypes, CVars).
+    type_vars_list(CTypes, CVars).
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.108
diff -u -b -r1.108 post_typecheck.m
--- compiler/post_typecheck.m	12 Sep 2006 04:41:41 -0000	1.108
+++ compiler/post_typecheck.m	19 Sep 2006 14:26:19 -0000
@@ -261,7 +261,7 @@
 check_type_bindings_2([], _, !UnresolvedVarsTypes, !Set).
 check_type_bindings_2([Var - Type | VarTypes], HeadTypeParams,
         !UnresolvedVarsTypes, !Set) :-
-    prog_type.vars(Type, TVars),
+    type_vars(Type, TVars),
     set.list_to_set(TVars, TVarsSet0),
     set.delete_list(TVarsSet0, HeadTypeParams, TVarsSet1),
     ( \+ set.empty(TVarsSet1) ->
@@ -956,7 +956,7 @@
         % Is the function symbol a higher-order predicate
         % or function constant?
         ConsId0 = cons(Name, _),
-        type_is_higher_order(TypeOfX, _Purity, PredOrFunc,
+        type_is_higher_order_details(TypeOfX, _Purity, PredOrFunc,
             EvalMethod, HOArgTypes),
 
         % We don't do this for the clause introduced by the compiler
Index: compiler/prog_foreign.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_foreign.m,v
retrieving revision 1.8
diff -u -b -r1.8 prog_foreign.m
--- compiler/prog_foreign.m	20 Aug 2006 08:21:25 -0000	1.8
+++ compiler/prog_foreign.m	19 Sep 2006 15:23:23 -0000
@@ -359,7 +359,7 @@
     % require changes to extras/dynamic_linking/name_mangle.m,
     % profiler/demangle.m, util/mdemangle.c and compiler/name_mangle.m.
 
-    ( string.is_alnum_or_underscore(Name) ->
+    ( string.is_all_alnum_or_underscore(Name) ->
         % Any names that start with `f_' are changed so that they start with
         % `f__', so that we can use names starting with `f_' (followed by
         % anything except an underscore) without fear of name collisions.
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.274
diff -u -b -r1.274 prog_io.m
--- compiler/prog_io.m	16 Sep 2006 10:46:39 -0000	1.274
+++ compiler/prog_io.m	19 Sep 2006 10:44:35 -0000
@@ -669,7 +669,7 @@
     % Parse the first term, treating it as occurring within the scope
     % of the special "root" module (so that any `:- module' declaration
     % is taken to be a non-nested module unless explicitly qualified).
-    parser.read_term(SourceFileName, MaybeFirstTerm, !IO),
+    parser.read_term_filename(SourceFileName, MaybeFirstTerm, !IO),
     root_module_name(RootModuleName),
     process_read_term(RootModuleName, MaybeFirstTerm, MaybeFirstItem),
     (
@@ -922,7 +922,7 @@
     io::di, io::uo) is det.
 
 read_item(ModuleName, SourceFileName, MaybeItem, !IO) :-
-    parser.read_term(SourceFileName, MaybeTerm, !IO),
+    parser.read_term_filename(SourceFileName, MaybeTerm, !IO),
     process_read_term(ModuleName, MaybeTerm, MaybeItem).
 
 :- pred process_read_term(module_name::in, read_term::in,
Index: compiler/prog_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_type.m,v
retrieving revision 1.26
diff -u -b -r1.26 prog_type.m
--- compiler/prog_type.m	7 Sep 2006 05:51:04 -0000	1.26
+++ compiler/prog_type.m	19 Sep 2006 14:27:38 -0000
@@ -53,14 +53,17 @@
     %
 :- pred type_is_higher_order(mer_type::in) is semidet.
 
-    % type_is_higher_order(Type, Purity, PredOrFunc, ArgTypes, EvalMeth):
-    % succeeds iff Type is a higher-order predicate or function type with
+    % type_is_higher_order_details(Type, Purity, PredOrFunc, ArgTypes,
+    %   EvalMeth):
+    %
+    % Succeeds iff Type is a higher-order predicate or function type with
     % the specified argument types (for functions, the return type is
     % appended to the end of the argument types), purity, and
     % evaluation method.
     %
-:- pred type_is_higher_order(mer_type::in, purity::out, pred_or_func::out,
-    lambda_eval_method::out, list(mer_type)::out) is semidet.
+:- pred type_is_higher_order_details(mer_type::in, purity::out,
+    pred_or_func::out, lambda_eval_method::out, list(mer_type)::out)
+    is semidet.
 
     % Succeed if the given type is a tuple type, returning
     % the argument types.
@@ -85,12 +88,12 @@
 
     % Succeeds iff the given type with the substitution applied is ground.
     %
-:- pred type_is_ground(mer_type::in, tsubst::in) is semidet.
+:- pred subst_type_is_ground(mer_type::in, tsubst::in) is semidet.
 
     % Succeeds iff the given type with the substitution applied is not
     % ground.
     %
-:- pred type_is_nonground(mer_type::in, tsubst::in) is semidet.
+:- pred subst_type_is_nonground(mer_type::in, tsubst::in) is semidet.
 
     % type_has_variable_arity_ctor(Type, TypeCtor, TypeArgs)
     % Check if the principal type constructor of Type is of variable arity.
@@ -128,12 +131,12 @@
     % Return a list of the type variables of a type, in order of their
     % first occurrence in a depth-first, left-right traversal.
     %
-:- pred vars(mer_type::in, list(tvar)::out) is det.
+:- pred type_vars(mer_type::in, list(tvar)::out) is det.
 
     % Return a list of the type variables of a list of types, in order
     % of their first occurrence in a depth-first, left-right traversal.
     %
-:- pred vars_list(list(mer_type)::in, list(tvar)::out) is det.
+:- pred type_vars_list(list(mer_type)::in, list(tvar)::out) is det.
 
     % Nondeterministically return the variables in a type.
     %
@@ -426,9 +429,10 @@
 type_is_higher_order(Type) :-
     strip_kind_annotation(Type) = higher_order_type(_, _, _, _).
 
-type_is_higher_order(Type0, Purity, PredOrFunc, EvalMethod, PredArgTypes) :-
-    Type = strip_kind_annotation(Type0),
-    Type = higher_order_type(ArgTypes, MaybeRetType, Purity, EvalMethod),
+type_is_higher_order_details(Type, Purity, PredOrFunc, EvalMethod,
+        PredArgTypes) :-
+    strip_kind_annotation(Type) =
+        higher_order_type(ArgTypes, MaybeRetType, Purity, EvalMethod),
     (
         MaybeRetType = yes(RetType),
         PredOrFunc = function,
@@ -457,19 +461,19 @@
 type_is_nonground(Type) :-
     type_contains_var(Type, _).
 
-type_is_ground(Type, TSubst) :-
-    \+ type_is_nonground(Type, TSubst).
+subst_type_is_ground(Type, TSubst) :-
+    \+ subst_type_is_nonground(Type, TSubst).
 
-type_is_nonground(Type, TSubst) :-
+subst_type_is_nonground(Type, TSubst) :-
     type_contains_var(Type, TVar),
     ( map.search(TSubst, TVar, Binding) ->
-        type_is_nonground(Binding, TSubst)
+        subst_type_is_nonground(Binding, TSubst)
     ;
         true
     ).
 
 type_has_variable_arity_ctor(Type, TypeCtor, TypeArgs) :-
-    ( type_is_higher_order(Type, _Purity, PredOrFunc, _, TypeArgs0) ->
+    ( type_is_higher_order_details(Type, _Purity, PredOrFunc, _, TypeArgs0) ->
         TypeArgs = TypeArgs0,
         PredOrFuncStr = prog_out.pred_or_func_to_str(PredOrFunc),
         TypeCtor = type_ctor(unqualified(PredOrFuncStr), 0)
@@ -575,45 +579,45 @@
     Type = type_variable(Var, Kind),
     var_list_to_type_list(KindMap, Vars, Types).
 
-vars(Type, TVars) :-
-    vars_2(Type, [], RevTVars),
+type_vars(Type, TVars) :-
+    type_vars_2(Type, [], RevTVars),
     list.reverse(RevTVars, TVarsDups),
     list.remove_dups(TVarsDups, TVars).
 
-:- pred vars_2(mer_type::in, list(tvar)::in, list(tvar)::out) is det.
+:- pred type_vars_2(mer_type::in, list(tvar)::in, list(tvar)::out) is det.
 
-vars_2(type_variable(Var, _), Vs, [Var | Vs]).
-vars_2(defined_type(_, Args, _), !V) :-
-    vars_list_2(Args, !V).
-vars_2(builtin_type(_), !V).
-vars_2(higher_order_type(Args, MaybeRet, _, _), !V) :-
-    vars_list_2(Args, !V),
+type_vars_2(type_variable(Var, _), Vs, [Var | Vs]).
+type_vars_2(defined_type(_, Args, _), !V) :-
+    type_vars_list_2(Args, !V).
+type_vars_2(builtin_type(_), !V).
+type_vars_2(higher_order_type(Args, MaybeRet, _, _), !V) :-
+    type_vars_list_2(Args, !V),
     (
         MaybeRet = yes(Ret),
-        vars_2(Ret, !V)
+        type_vars_2(Ret, !V)
     ;
         MaybeRet = no
     ).
-vars_2(tuple_type(Args, _), !V) :-
-    vars_list_2(Args, !V).
-vars_2(apply_n_type(Var, Args, _), !V) :-
+type_vars_2(tuple_type(Args, _), !V) :-
+    type_vars_list_2(Args, !V).
+type_vars_2(apply_n_type(Var, Args, _), !V) :-
     !:V = [Var | !.V],
-    vars_list_2(Args, !V).
-vars_2(kinded_type(Type, _), !V) :-
-    vars_2(Type, !V).
+    type_vars_list_2(Args, !V).
+type_vars_2(kinded_type(Type, _), !V) :-
+    type_vars_2(Type, !V).
 
-vars_list(Types, TVars) :-
-    vars_list_2(Types, [], RevTVars),
+type_vars_list(Types, TVars) :-
+    type_vars_list_2(Types, [], RevTVars),
     list.reverse(RevTVars, TVarsDups),
     list.remove_dups(TVarsDups, TVars).
 
-:- pred vars_list_2(list(mer_type)::in, list(tvar)::in, list(tvar)::out)
+:- pred type_vars_list_2(list(mer_type)::in, list(tvar)::in, list(tvar)::out)
     is det.
 
-vars_list_2([], !V).
-vars_list_2([Type | Types], !V) :-
-    vars_2(Type, !V),
-    vars_list_2(Types, !V).
+type_vars_list_2([], !V).
+type_vars_list_2([Type | Types], !V) :-
+    type_vars_2(Type, !V),
+    type_vars_list_2(Types, !V).
 
 type_contains_var(type_variable(Var, _), Var).
 type_contains_var(defined_type(_, Args, _), Var) :-
@@ -726,7 +730,7 @@
     list.condense(TVarsList, TVars).
 
 constraint_get_tvars(constraint(_Name, Args), TVars) :-
-    vars_list(Args, TVars).
+    type_vars_list(Args, TVars).
 
 get_unconstrained_tvars(Tvars, Constraints, Unconstrained) :-
     constraint_list_get_tvars(Constraints, ConstrainedTvars),
@@ -1282,11 +1286,10 @@
 %-----------------------------------------------------------------------------%
 
 type_list_subsumes(TypesA, TypesB, TypeSubst) :-
-    %
     % TypesA subsumes TypesB iff TypesA can be unified with TypesB
     % without binding any of the type variables in TypesB.
-    %
-    prog_type.vars_list(TypesB, TypesBVars),
+
+    type_vars_list(TypesB, TypesBVars),
     map.init(TypeSubst0),
     type_unify_list(TypesA, TypesB, TypesBVars, TypeSubst0, TypeSubst).
 
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.26
diff -u -b -r1.26 pseudo_type_info.m
--- compiler/pseudo_type_info.m	7 Sep 2006 05:51:04 -0000	1.26
+++ compiler/pseudo_type_info.m	19 Sep 2006 14:22:37 -0000
@@ -240,7 +240,7 @@
 :- pred type_is_var_arity(mer_type::in, var_arity_ctor_id::out) is semidet.
 
 type_is_var_arity(Type, VarArityCtorId) :-
-    ( type_is_higher_order(Type, _Purity, PredOrFunc, _, _) ->
+    ( type_is_higher_order_details(Type, _Purity, PredOrFunc, _, _) ->
         (
             PredOrFunc = predicate,
             VarArityCtorId = pred_type_info
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.103
diff -u -b -r1.103 purity.m
--- compiler/purity.m	12 Sep 2006 04:41:42 -0000	1.103
+++ compiler/purity.m	19 Sep 2006 14:26:28 -0000
@@ -694,7 +694,7 @@
     map.lookup(VarTypes, Var, TypeOfVar),
     (
         ConsId = cons(PName, _),
-        type_is_higher_order(TypeOfVar, TypePurity, PredOrFunc,
+        type_is_higher_order_details(TypeOfVar, TypePurity, PredOrFunc,
             _EvalMethod, VarArgTypes)
     ->
         PredInfo = !.Info ^ pred_info,
Index: compiler/qual_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/qual_info.m,v
retrieving revision 1.16
diff -u -b -r1.16 qual_info.m
--- compiler/qual_info.m	10 Sep 2006 23:39:08 -0000	1.16
+++ compiler/qual_info.m	19 Sep 2006 14:30:30 -0000
@@ -200,7 +200,7 @@
 
     % Find any new type variables introduced by this type, and
     % add them to the var-name index and the variable renaming.
-    prog_type.vars(Type1, TVars),
+    type_vars(Type1, TVars),
     get_new_tvars(TVars, VarSet, TVarSet0, TVarSet1,
         TVarNameMap0, TVarNameMap, TVarRenaming0, TVarRenaming),
 
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.188
diff -u -b -r1.188 simplify.m
--- compiler/simplify.m	5 Sep 2006 06:21:31 -0000	1.188
+++ compiler/simplify.m	19 Sep 2006 14:27:48 -0000
@@ -1782,7 +1782,7 @@
         call_generic_unify(TypeInfoVar, XVar, YVar, ModuleInfo, !.Info,
             Context, GoalInfo0, Call)
 
-    ; type_is_higher_order(Type, _, _, _, _) ->
+    ; type_is_higher_order(Type) ->
         % Convert higher-order unifications into calls to
         % builtin_unify_pred (which calls error/1).
         goal_info_get_context(GoalInfo0, GContext),
@@ -1914,7 +1914,7 @@
         % Call polymorphism.m to create the type_infos.
         create_poly_info(ModuleInfo0, !.PredInfo, !.ProcInfo, !:PolyInfo),
         term.context_init(Context),
-        polymorphism.make_type_info_vars(Types, Context,
+        polymorphism_make_type_info_vars(Types, Context,
             TypeInfoVars, TypeInfoGoals, !PolyInfo),
         poly_info_extract(!.PolyInfo, !PredInfo, !ProcInfo, ModuleInfo1),
 
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.55
diff -u -b -r1.55 stratify.m
--- compiler/stratify.m	10 Sep 2006 23:39:09 -0000	1.55
+++ compiler/stratify.m	19 Sep 2006 14:27:58 -0000
@@ -669,7 +669,7 @@
         % XXX Will have to use a more general check for higher order constants
         % in parameters user could hide higher order consts in a data structure
         % etc..
-        type_is_higher_order(Type, _, _, _, _)
+        type_is_higher_order(Type)
     ->
         ( mode_is_input(ModuleInfo, Mode) ->
             !:HOIn = yes
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.120
diff -u -b -r1.120 table_gen.m
--- compiler/table_gen.m	10 Sep 2006 23:39:10 -0000	1.120
+++ compiler/table_gen.m	19 Sep 2006 14:32:01 -0000
@@ -2309,7 +2309,7 @@
         lookup_tabling_category(TypeCat, MaybeCatStringStep),
         (
             MaybeCatStringStep = no,
-            prog_type.vars(Type, TypeVars),
+            type_vars(Type, TypeVars),
             (
                 ArgTablingMethod = arg_value,
                 (
@@ -3447,7 +3447,7 @@
 
     % Call polymorphism.m to create the type_infos.
     create_poly_info(ModuleInfo0, PredInfo0, ProcInfo2, PolyInfo0),
-    polymorphism.make_type_info_vars(Types, Context,
+    polymorphism_make_type_info_vars(Types, Context,
         TypeInfoVars, TypeInfoGoals, PolyInfo0, PolyInfo),
     poly_info_extract(PolyInfo, PredInfo0, PredInfo,
         ProcInfo0, ProcInfo, ModuleInfo),
Index: compiler/term_constr_build.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_build.m,v
retrieving revision 1.11
diff -u -b -r1.11 term_constr_build.m
--- compiler/term_constr_build.m	20 Aug 2006 08:21:31 -0000	1.11
+++ compiler/term_constr_build.m	19 Sep 2006 14:32:12 -0000
@@ -795,7 +795,7 @@
     VarTypes = !.Info ^ types,
     Type = VarTypes ^ det_elem(Var),
     ( 
-        not type_is_higher_order(Type, _, _, _, _),
+        not type_is_higher_order(Type),
         type_to_ctor_and_args(Type, TypeCtor, _)
     ->
         Norm   = !.Info ^ norm,
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.51
diff -u -b -r1.51 term_traversal.m
--- compiler/term_traversal.m	5 Sep 2006 06:21:32 -0000	1.51
+++ compiler/term_traversal.m	19 Sep 2006 14:32:20 -0000
@@ -512,7 +512,7 @@
     params_get_functor_info(Params, FunctorInfo),
     params_get_var_types(Params, VarTypes),
     map.lookup(VarTypes, OutVar, Type),
-    \+ type_is_higher_order(Type, _, _, _, _),
+    \+ type_is_higher_order(Type),
     ( type_to_ctor_and_args(Type, TypeCtor, _) ->
         filter_args_and_modes(VarTypes, Args0, Args1, Modes0, Modes1),
         functor_norm(FunctorInfo, TypeCtor, ConsId, ModuleInfo,
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.52
diff -u -b -r1.52 term_util.m
--- compiler/term_util.m	20 Aug 2006 08:21:32 -0000	1.52
+++ compiler/term_util.m	19 Sep 2006 14:32:27 -0000
@@ -348,7 +348,7 @@
 horder_vars([Arg | Args], VarType) :-
     (
         map.lookup(VarType, Arg, Type),
-        type_is_higher_order(Type, _, _, _, _)
+        type_is_higher_order(Type)
     ;
         horder_vars(Args, VarType)
     ).
Index: compiler/trace_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_gen.m,v
retrieving revision 1.5
diff -u -b -r1.5 trace_gen.m
--- compiler/trace_gen.m	22 Aug 2006 05:04:11 -0000	1.5
+++ compiler/trace_gen.m	19 Sep 2006 14:31:05 -0000
@@ -974,7 +974,7 @@
     ),
     LiveType = live_value_var(Var, Name, Type, LldsInst),
     VarInfo = layout_var_info(direct(Lval), LiveType, "trace"),
-    prog_type.vars(Type, TypeVars),
+    type_vars(Type, TypeVars),
     set.insert_list(!.Tvars, TypeVars, !:Tvars).
 
 %-----------------------------------------------------------------------------%
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.34
diff -u -b -r1.34 trace_params.m
--- compiler/trace_params.m	22 Aug 2006 05:04:11 -0000	1.34
+++ compiler/trace_params.m	19 Sep 2006 15:20:53 -0000
@@ -338,7 +338,7 @@
 trace_level_has_proc_body_reps(decl_rep) = yes.
 
 convert_trace_suppress(SuppressString, SuppressItemSet) :-
-    SuppressWords = string.words(char_is_comma, SuppressString),
+    SuppressWords = string.words_separator(char_is_comma, SuppressString),
     list.map(convert_item_name, SuppressWords, SuppressItemLists),
     list.condense(SuppressItemLists, SuppressItems),
     set.list_to_set(SuppressItems, SuppressItemSet).
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.82
diff -u -b -r1.82 type_ctor_info.m
--- compiler/type_ctor_info.m	7 Sep 2006 05:51:06 -0000	1.82
+++ compiler/type_ctor_info.m	19 Sep 2006 14:23:05 -0000
@@ -813,7 +813,7 @@
     list.map((pred(C::in, Ts::out) is det :- C = constraint(_, Ts)),
         Constraints, ConstrainedTvars0),
     list.condense(ConstrainedTvars0, ConstrainedTvars1),
-    prog_type.vars_list(ConstrainedTvars1, ConstrainedTvars2),
+    type_vars_list(ConstrainedTvars1, ConstrainedTvars2),
     list.delete_elems(ExistTvars, ConstrainedTvars2, UnconstrainedTvars),
         % We do this to maintain the ordering of the type variables.
     list.delete_elems(ExistTvars, UnconstrainedTvars, ConstrainedTvars),
@@ -856,7 +856,7 @@
 first_matching_type_class_info([C | Cs], Tvar, MatchingConstraint, !N,
         TypeInfoIndex) :-
     C = constraint(_, Ts),
-    prog_type.vars_list(Ts, TVs),
+    type_vars_list(Ts, TVs),
     ( list.nth_member_search(TVs, Tvar, Index) ->
         MatchingConstraint = C,
         TypeInfoIndex = Index
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.169
diff -u -b -r1.169 type_util.m
--- compiler/type_util.m	7 Sep 2006 05:51:06 -0000	1.169
+++ compiler/type_util.m	19 Sep 2006 14:28:17 -0000
@@ -888,9 +888,9 @@
 maybe_get_higher_order_arg_types(MaybeType, Arity, MaybeTypes) :-
     (
         MaybeType = yes(Type),
-        type_is_higher_order(Type, _, _, _, Types)
+        type_is_higher_order_details(Type, _, _, _, ArgTypes)
     ->
-        MaybeTypes = list.map(func(T) = yes(T), Types)
+        MaybeTypes = list.map(func(T) = yes(T), ArgTypes)
     ;
         list.duplicate(Arity, no, MaybeTypes)
     ).
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.404
diff -u -b -r1.404 typecheck.m
--- compiler/typecheck.m	12 Sep 2006 04:41:42 -0000	1.404
+++ compiler/typecheck.m	19 Sep 2006 14:35:56 -0000
@@ -430,7 +430,7 @@
                 % We also need to set the head_type_params field to indicate
                 % that all the existentially quantified tvars in the head
                 % of this pred are indeed bound by this predicate.
-                prog_type.vars_list(ArgTypes0, HeadVarsIncludingExistentials),
+                type_vars_list(ArgTypes0, HeadVarsIncludingExistentials),
                 pred_info_set_head_type_params(HeadVarsIncludingExistentials,
                     !PredInfo),
                 Specs = [],
@@ -462,7 +462,7 @@
                     write_pred_progress_message("% Type-checking ", PredId,
                         !.ModuleInfo, !IO)
                 ),
-                prog_type.vars_list(ArgTypes0, !:HeadTypeParams),
+                type_vars_list(ArgTypes0, !:HeadTypeParams),
                 pred_info_get_class_context(!.PredInfo, PredConstraints),
                 constraint_list_get_tvars(PredConstraints ^ univ_constraints,
                     UnivTVars),
@@ -523,7 +523,7 @@
             % apply only to the head variables, and those that apply to
             % type variables which occur only in the body.
             map.apply_to_list(HeadVars, InferredVarTypes, ArgTypes),
-            prog_type.vars_list(ArgTypes, ArgTypeVars),
+            type_vars_list(ArgTypes, ArgTypeVars),
             restrict_to_head_vars(InferredTypeConstraints0, ArgTypeVars,
                 InferredTypeConstraints, UnprovenBodyConstraints),
 
@@ -2702,7 +2702,7 @@
         %   Pair0 = 1 - 'a',
         %   Pair = Pair0 ^ snd := 2.
 
-        prog_type.vars(FieldType, TVarsInField),
+        type_vars(FieldType, TVarsInField),
         (
             TVarsInField = [],
             TVarSet = TVarSet0,
@@ -2733,7 +2733,7 @@
             %
             list.replace_nth_det(ConsArgTypes, FieldNumber, int_type,
                 ArgTypesWithoutField),
-            prog_type.vars_list(ArgTypesWithoutField, TVarsInOtherArgs),
+            type_vars_list(ArgTypesWithoutField, TVarsInOtherArgs),
             set.intersect(
                 set.list_to_set(TVarsInField),
                 set.intersect(
@@ -2761,7 +2761,7 @@
                 % onto the set of type variables occuring in the types of the
                 % arguments of the call to `'field :='/2'. Note that we have
                 % already flipped the constraints.
-                prog_type.vars_list([FunctorType, FieldType], CallTVars0),
+                type_vars_list([FunctorType, FieldType], CallTVars0),
                 set.list_to_set(CallTVars0, CallTVars),
                 project_and_rename_constraints(ClassTable, TVarSet, CallTVars,
                     TVarRenaming, Constraints0, Constraints),
@@ -2809,7 +2809,7 @@
 
 project_constraint(CallTVars, Constraint) :-
     Constraint = constraint(_, _, TypesToCheck),
-    prog_type.vars_list(TypesToCheck, TVarsToCheck0),
+    type_vars_list(TypesToCheck, TVarsToCheck0),
     set.list_to_set(TVarsToCheck0, TVarsToCheck),
     set.intersect(TVarsToCheck, CallTVars, RelevantTVars),
     \+ set.empty(RelevantTVars).
Index: compiler/typecheck_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_info.m,v
retrieving revision 1.16
diff -u -b -r1.16 typecheck_info.m
--- compiler/typecheck_info.m	12 Sep 2006 04:41:43 -0000	1.16
+++ compiler/typecheck_info.m	19 Sep 2006 14:29:17 -0000
@@ -457,9 +457,9 @@
         % too?)
 
         map.values(VarTypes, Types),
-        prog_type.vars_list(Types, TypeVars0),
+        type_vars_list(Types, TypeVars0),
         map.values(OldExplicitVarTypes, ExplicitTypes),
-        prog_type.vars_list(ExplicitTypes, ExplicitTypeVars0),
+        type_vars_list(ExplicitTypes, ExplicitTypeVars0),
         map.keys(ExistTypeRenaming, ExistQVarsToBeRenamed),
         list.delete_elems(OldExistQVars, ExistQVarsToBeRenamed,
             ExistQVarsToRemain),
Index: compiler/typeclasses.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typeclasses.m,v
retrieving revision 1.14
diff -u -b -r1.14 typeclasses.m
--- compiler/typeclasses.m	12 Sep 2006 04:41:43 -0000	1.14
+++ compiler/typeclasses.m	19 Sep 2006 14:29:31 -0000
@@ -491,7 +491,7 @@
 subsumes_on_elements(Elements, TypesA, TypesB, Subst) :-
     RTypesA = restrict_list_elements(Elements, TypesA),
     RTypesB = restrict_list_elements(Elements, TypesB),
-    prog_type.vars_list(RTypesB, RTypesBVars),
+    type_vars_list(RTypesB, RTypesBVars),
     map.init(Subst0),
     type_unify_list(RTypesA, RTypesB, RTypesBVars, Subst0, Subst).
 
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.172
diff -u -b -r1.172 unify_proc.m
--- compiler/unify_proc.m	22 Aug 2006 05:04:13 -0000	1.172
+++ compiler/unify_proc.m	19 Sep 2006 13:39:41 -0000
@@ -591,12 +591,11 @@
     % for polymorphic types.
     module_info_set_pred_info(PredId, PredInfo, !ModuleInfo),
 
-    % Note that this will not work if the generated clauses call
-    % a polymorphic predicate which requires type_infos to be added.
-    % Such calls can be generated by generate_clause_info,
-    % but unification predicates which contain such calls are never
-    % generated lazily.
-    polymorphism.process_generated_pred(PredId, !ModuleInfo).
+    % Note that this will not work if the generated clauses call a polymorphic
+    % predicate which requires type_infos to be added. Such calls can be
+    % generated by generate_clause_info, but unification predicates which
+    % contain such calls are never generated lazily.
+    polymorphism_process_generated_pred(PredId, !ModuleInfo).
 
 :- type unify_pred_item
     --->    declaration
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.135
diff -u -b -r1.135 unused_args.m
--- compiler/unused_args.m	10 Sep 2006 23:39:10 -0000	1.135
+++ compiler/unused_args.m	19 Sep 2006 14:32:35 -0000
@@ -543,7 +543,7 @@
 
 setup_typeinfo_dep(Var, VarTypeMap, PredProcId, RttiVarMaps, !VarDep) :-
     map.lookup(VarTypeMap, Var, Type),
-    prog_type.vars(Type, TVars),
+    type_vars(Type, TVars),
     list.map((pred(TVar::in, TypeInfoVar::out) is det :-
         rtti_lookup_type_info_locn(RttiVarMaps, TVar, Locn),
         type_info_locn_var(Locn, TypeInfoVar)
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
Index: deep_profiler/exclude.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/exclude.m,v
retrieving revision 1.8
diff -u -b -r1.8 exclude.m
--- deep_profiler/exclude.m	29 Mar 2006 08:07:40 -0000	1.8
+++ deep_profiler/exclude.m	19 Sep 2006 15:41:57 -0000
@@ -125,7 +125,7 @@
             Line = Line0
         ),
         (
-            Words = string.words(char.is_whitespace, Line),
+            Words = string.words_separator(char.is_whitespace, Line),
             Words = [Scope, ModuleName],
             (
                 Scope = "all",
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.355
diff -u -b -r1.355 io.m
--- library/io.m	31 Aug 2006 11:09:52 -0000	1.355
+++ library/io.m	19 Sep 2006 11:38:10 -0000
@@ -3637,7 +3637,7 @@
     io.process_read_term(ReadResult, LineNumber, Result).
 
 io.read_from_string(FileName, String, Len, Result, !Posn) :-
-    parser.read_term_from_string(FileName, String, Len, !Posn, ReadResult),
+    parser.read_term_from_substring(FileName, String, Len, !Posn, ReadResult),
     !.Posn = posn(LineNumber, _, _),
     io.process_read_term(ReadResult, LineNumber, Result).
 
@@ -4055,7 +4055,8 @@
             term_io.quote_atom(Functor, !IO),
             io.write_char(')', !IO)
         ;
-            term_io.quote_atom(Functor, maybe_adjacent_to_graphic_token, !IO)
+            term_io.quote_atom_agt(Functor, maybe_adjacent_to_graphic_token,
+                !IO)
         ),
         (
             Args = [X | Xs]
Index: library/lexer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/lexer.m,v
retrieving revision 1.48
diff -u -b -r1.48 lexer.m
--- library/lexer.m	3 Aug 2006 06:30:07 -0000	1.48
+++ library/lexer.m	19 Sep 2006 11:58:19 -0000
@@ -76,7 +76,8 @@
     %
 :- type offset == int.
 
-    % string_get_token_list(String, MaxOffset, Tokens, InitialPos, FinalPos):
+    % string_get_token_list_max(String, MaxOffset, Tokens,
+    %   InitialPos, FinalPos):
     %
     % Scan a list of tokens from a string, starting at the current offset
     % specified by InitialPos. Keep scanning until either we encounter either
@@ -85,11 +86,12 @@
     % Return the tokens scanned in Tokens, and return the position one
     % character past the end of the last token in FinalPos.
     %
-:- pred string_get_token_list(string::in, offset::in, token_list::out,
+:- pred string_get_token_list_max(string::in, offset::in, token_list::out,
     posn::in, posn::out) is det.
 
     % string_get_token_list(String, Tokens, InitialPos, FinalPos):
-    % calls string_get_token_list/5 above with MaxPos = length of String.
+    %
+    % calls string_get_token_list_max above with MaxPos = length of String.
     %
 :- pred string_get_token_list(string::in, token_list::out,
     posn::in, posn::out) is det.
@@ -221,9 +223,9 @@
 
 string_get_token_list(String, Tokens, !Posn) :-
     string.length(String, Len),
-    string_get_token_list(String, Len, Tokens, !Posn).
+    string_get_token_list_max(String, Len, Tokens, !Posn).
 
-string_get_token_list(String, Len, Tokens, !Posn) :-
+string_get_token_list_max(String, Len, Tokens, !Posn) :-
     string_get_token(String, Len, Token, Context, !Posn),
     ( Token = eof ->
         Tokens = token_nil
@@ -231,7 +233,7 @@
         Tokens = token_cons(Token, Context, token_nil)
     ;
         Tokens = token_cons(Token, Context, Tokens1),
-        string_get_token_list(String, Len, Tokens1, !Posn)
+        string_get_token_list_max(String, Len, Tokens1, !Posn)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -305,8 +307,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred get_token(token::out, token_context::out, io::di, io::uo)
-    is det.
+:- pred get_token(token::out, token_context::out, io::di, io::uo) is det.
 
 get_token(Token, Context, !IO) :-
     io.read_char(Result, !IO),
Index: library/list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.153
diff -u -b -r1.153 list.m
--- library/list.m	7 Sep 2006 05:51:22 -0000	1.153
+++ library/list.m	19 Sep 2006 13:14:20 -0000
@@ -1636,13 +1636,13 @@
 
 %-----------------------------------------------------------------------------%
 
-list.duplicate(N, X, list.duplicate(N, X, [])).
+list.duplicate(N, X, list.duplicate_2(N, X, [])).
 
-:- func list.duplicate(int, T, list(T)) = list(T).
+:- func list.duplicate_2(int, T, list(T)) = list(T).
 
-list.duplicate(N, X, Xs) =
+list.duplicate_2(N, X, Xs) =
     ( N > 0 ->
-        list.duplicate(N-1, X, [X|Xs])
+        list.duplicate_2(N - 1, X, [X | Xs])
     ;
         Xs
     ).
Index: library/parser.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/parser.m,v
retrieving revision 1.52
diff -u -b -r1.52 parser.m
--- library/parser.m	19 Apr 2006 05:17:54 -0000	1.52
+++ library/parser.m	19 Sep 2006 12:00:27 -0000
@@ -45,10 +45,6 @@
 
 %-----------------------------------------------------------------------------%
 
-    % read_term/{3,4}:
-    %
-    % Reads in (and parses) terms from the current input stream.
-
     % read_term(Result):
     %
     % Reads a Mercury term from the current input stream.
@@ -63,28 +59,25 @@
 :- pred read_term_with_op_table(Ops::in, read_term(T)::out, io::di, io::uo)
     is det <= op_table(Ops).
 
-    % read_term(FileName, Result):
+    % read_term_filename(FileName, Result, !IO):
     %
     % Reads a term from the current input stream. The string is the filename
     % to use for the current input stream; this is used in constructing the
     % term.contexts in the read term. This interface is used to support
     % the `:- pragma source_file' directive.
     %
-:- pred read_term(string::in, read_term(T)::out, io::di, io::uo) is det.
+:- pred read_term_filename(string::in, read_term(T)::out, io::di, io::uo)
+    is det.
 
-    % read_term_with_op_table(Ops, FileName, Result):
+    % read_term_filename_with_op_table(Ops, FileName, Result, !IO):
     %
     % As above but using the given op_table.
     %
-:- pred read_term_with_op_table(Ops::in, string::in, read_term(T)::out,
-    io::di, io::uo) is det <= op_table(Ops).
+:- pred read_term_filename_with_op_table(Ops::in, string::in,
+    read_term(T)::out, io::di, io::uo) is det <= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
 
-    % read_term_from_string/{4,6}:
-    %
-    % Parses terms from a string.
-
     % The read_term_from_string predicates are the same as the read_term
     % predicates, except that the term is read from a string rather than from
     % the current input stream. The returned value `EndPos' is the position
@@ -106,22 +99,18 @@
     % read_term_from_string(FileName, String, MaxOffset, StartPos,
     %   EndPos, Term).
     %
-:- pred read_term_from_string(string::in, string::in, int::in,
+:- pred read_term_from_substring(string::in, string::in, int::in,
     posn::in, posn::out, read_term(T)::out) is det.
 
     % read_term_from_string_with_op_table(Ops, FileName, String,
     %   MaxOffset, StartPos, EndPos, Term).
     %
-:- pred read_term_from_string_with_op_table(Ops::in, string::in,
+:- pred read_term_from_substring_with_op_table(Ops::in, string::in,
     string::in, int::in, posn::in, posn::out, read_term(T)::out) is det
     <= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
 
-    % parse_tokens/{3,4}:
-    %
-    % Parses a list of tokens.
-
     % parse_tokens(FileName, TokenList, Result):
     %
 :- pred parse_tokens(string::in, token_list::in, read_term(T)::out) is det.
@@ -163,16 +152,18 @@
 
 read_term(Result, !IO) :-
     io.input_stream_name(FileName, !IO),
-    read_term_with_op_table(ops.init_mercury_op_table, FileName, Result, !IO).
+    read_term_filename_with_op_table(ops.init_mercury_op_table, FileName,
+        Result, !IO).
 
 read_term_with_op_table(Ops, Result, !IO) :-
     io.input_stream_name(FileName, !IO),
-    read_term_with_op_table(Ops, FileName, Result, !IO).
+    read_term_filename_with_op_table(Ops, FileName, Result, !IO).
 
-read_term(FileName, Result, !IO) :-
-    read_term_with_op_table(ops.init_mercury_op_table, FileName, Result, !IO).
+read_term_filename(FileName, Result, !IO) :-
+    read_term_filename_with_op_table(ops.init_mercury_op_table, FileName,
+        Result, !IO).
 
-read_term_with_op_table(Ops, FileName, Result, !IO) :-
+read_term_filename_with_op_table(Ops, FileName, Result, !IO) :-
     lexer.get_token_list(Tokens, !IO),
     parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
 
@@ -183,16 +174,16 @@
 read_term_from_string_with_op_table(Ops, FileName, String, EndPos, Result) :-
     string.length(String, Len),
     StartPos = posn(1, 0, 0),
-    read_term_from_string_with_op_table(Ops, FileName, String, Len,
+    read_term_from_substring_with_op_table(Ops, FileName, String, Len,
         StartPos, EndPos, Result).
 
-read_term_from_string(FileName, String, Len, StartPos, EndPos, Result) :-
-    read_term_from_string_with_op_table(ops.init_mercury_op_table,
+read_term_from_substring(FileName, String, Len, StartPos, EndPos, Result) :-
+    read_term_from_substring_with_op_table(ops.init_mercury_op_table,
         FileName, String, Len, StartPos, EndPos, Result).
 
-read_term_from_string_with_op_table(Ops, FileName, String, Len,
+read_term_from_substring_with_op_table(Ops, FileName, String, Len,
         StartPos, EndPos, Result) :-
-    lexer.string_get_token_list(String, Len, Tokens, StartPos, EndPos),
+    lexer.string_get_token_list_max(String, Len, Tokens, StartPos, EndPos),
     parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
 
 %-----------------------------------------------------------------------------%
@@ -205,9 +196,9 @@
     ( Tokens = token_nil ->
         Result = eof
     ;
-        init_state(Ops, FileName, Tokens, ParserState0),
+        init_parser_state(Ops, FileName, Tokens, ParserState0),
         parse_whole_term(Term, ParserState0, ParserState),
-        final_state(ParserState, VarSet, LeftOverTokens),
+        final_parser_state(ParserState, VarSet, LeftOverTokens),
         check_for_errors(Term, VarSet, Tokens, LeftOverTokens, Result)
     ).
 
@@ -224,7 +215,7 @@
         % Find the token that caused the error.
         ( ErrorTokens = token_cons(ErrorTok, ErrorTokLineNum, _) ->
             lexer.token_to_string(ErrorTok, TokString),
-            string.append_list( ["Syntax error at ", TokString, ": ",
+            string.append_list(["Syntax error at ", TokString, ": ",
                 ErrorMessage], Message),
             LineNum = ErrorTokLineNum
         ;
@@ -273,10 +264,10 @@
 parse_whole_term(Term, !PS) :-
     parse_term(Term0, !PS),
     ( Term0 = ok(_) ->
-        ( get_token(end, !PS) ->
+        ( parser_get_token(end, !PS) ->
             Term = Term0
         ;
-            unexpected("operator or `.' expected", Term, !PS)
+            parser_unexpected("operator or `.' expected", Term, !PS)
         )
     ;
         % Propagate error upwards.
@@ -331,11 +322,11 @@
     state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
 parse_left_term(MaxPriority, TermKind, OpPriority, Term, !PS) :-
-    ( get_token(Token, Context, !PS) ->
+    ( parser_get_token_context(Token, Context, !PS) ->
         (
             % Check for unary minus of integer.
             Token = name("-"),
-            get_token(integer(X), _IntContext, !PS)
+            parser_get_token_context(integer(X), _IntContext, !PS)
         ->
             get_term_context(!.PS, Context, TermContext),
             NegX = 0 - X,
@@ -344,7 +335,7 @@
         ;
             % Check for unary minus of float.
             Token = name("-"),
-            get_token(float(F), _FloatContext, !PS)
+            parser_get_token_context(float(F), _FloatContext, !PS)
         ->
             get_term_context(!.PS, Context, TermContext),
             NegF = 0.0 - F,
@@ -353,12 +344,12 @@
         ;
             % Check for binary prefix op.
             Token = name(Op),
-            \+ peek_token(open_ct, !.PS, _),
+            \+ parser_peek_token(open_ct, !.PS, _),
             get_ops_table(!.PS, OpTable),
             ops.lookup_binary_prefix_op(OpTable, Op, BinOpPriority,
                 RightAssoc, RightRightAssoc),
             BinOpPriority =< MaxPriority,
-            peek_token(NextToken, !PS),
+            parser_peek_token(NextToken, !PS),
             could_start_term(NextToken, yes)
         ->
             adjust_priority_for_assoc(BinOpPriority,
@@ -385,11 +376,11 @@
         ;
             % Check for unary prefix op.
             Token = name(Op),
-            \+ peek_token(open_ct, !.PS, _),
+            \+ parser_peek_token(open_ct, !.PS, _),
             get_ops_table(!.PS, OpTable),
             ops.lookup_prefix_op(OpTable, Op, UnOpPriority, RightAssoc),
             UnOpPriority =< MaxPriority,
-            peek_token(NextToken, !PS),
+            parser_peek_token(NextToken, !PS),
             could_start_term(NextToken, yes)
         ->
             adjust_priority_for_assoc(UnOpPriority, RightAssoc,
@@ -409,7 +400,7 @@
             OpPriority = 0
         )
     ;
-        error(!.PS, "unexpected end-of-file at start of sub-term", Term),
+        Term = make_error(!.PS, "unexpected end-of-file at start of sub-term"),
         OpPriority = 0
     ).
 
@@ -420,7 +411,7 @@
 parse_rest(MaxPriority, TermKind, LeftPriority, LeftTerm, Term, !PS) :-
     (
         % Infix op.
-        get_token(Token, Context, !PS),
+        parser_get_token_context(Token, Context, !PS),
         (
             Token = comma,
             TermKind = ordinary_term,
@@ -444,7 +435,7 @@
             LeftAssoc = LeftAssoc0,
             RightAssoc = RightAssoc0,
             parse_backquoted_operator(Qualifier, Op, VariableTerm, !PS),
-            get_token(name("`"), _, !PS)
+            parser_get_token(name("`"), !PS)
         ;
             Op = Op0,
             VariableTerm = [],
@@ -478,7 +469,7 @@
         )
     ;
         % Postfix op.
-        get_token(name(Op), Context, !PS),
+        parser_get_token_context(name(Op), Context, !PS),
         get_ops_table(!.PS, OpTable),
         ops.lookup_postfix_op(OpTable, Op, OpPriority, LeftAssoc),
         OpPriority =< MaxPriority,
@@ -496,7 +487,7 @@
     state(Ops, T)::in, state(Ops, T)::out) is semidet <= op_table(Ops).
 
 parse_backquoted_operator(Qualifier, OpName, VariableTerm, !PS) :-
-    get_token(Token, Context, !PS),
+    parser_get_token_context(Token, Context, !PS),
     (
         Token = variable(VariableOp),
         Qualifier = no,
@@ -518,13 +509,13 @@
 parse_backquoted_operator_2(Qualifier0, Qualifier, OpCtxt0, OpName0, OpName,
         !PS) :-
     (
-        get_token(name(ModuleSeparator), SepContext, !PS),
+        parser_get_token_context(name(ModuleSeparator), SepContext, !PS),
         (
             ModuleSeparator = "."
         ;
             ModuleSeparator = ":"
         ),
-        get_token(name(OpName1), NameContext, !PS),
+        parser_get_token_context(name(OpName1), NameContext, !PS),
         OpName1 \= "`"
     ->
         get_term_context(!.PS, SepContext, SepCtxt),
@@ -554,7 +545,7 @@
     ( parse_simple_term_2(Token, Context, Priority, Term0, !PS) ->
         check_for_higher_order_term(Term0, Context, Term, !PS)
     ;
-        unexpected_tok(Token, Context,
+        parser_unexpected_tok(Token, Context,
             "unexpected token at start of (sub)term", Term, !PS)
     ).
 
@@ -583,7 +574,7 @@
 
 parse_simple_term_2(name(Atom), Context, Prec, Term, !PS) :-
     get_term_context(!.PS, Context, TermContext),
-    ( get_token(open_ct, !PS) ->
+    ( parser_get_token(open_ct, !PS) ->
         parse_args(Args0, !PS),
         (
             Args0 = ok(Args),
@@ -622,10 +613,10 @@
 parse_simple_term_2(open, _, _, Term, !PS) :-
     parse_term(Term0, !PS),
     ( Term0 = ok(_) ->
-        ( get_token(close, !PS) ->
+        ( parser_get_token(close, !PS) ->
             Term = Term0
         ;
-            unexpected("expecting `)' or operator", Term, !PS)
+            parser_unexpected("expecting `)' or operator", Term, !PS)
         )
     ;
         % Propagate error upwards.
@@ -637,7 +628,7 @@
 
 parse_simple_term_2(open_list, Context, _, Term, !PS) :-
     get_term_context(!.PS, Context, TermContext),
-    ( get_token(close_list, !PS) ->
+    ( parser_get_token(close_list, !PS) ->
         parse_special_atom("[]", TermContext, Term, !PS)
     ;
         parse_list(Term, !PS)
@@ -645,7 +636,7 @@
 
 parse_simple_term_2(open_curly, Context, _, Term, !PS) :-
     get_term_context(!.PS, Context, TermContext),
-    ( get_token(close_curly, !PS) ->
+    ( parser_get_token(close_curly, !PS) ->
         parse_special_atom("{}", TermContext, Term, !PS)
     ;
         % This is a slight departure from ISO Prolog syntax -- instead of
@@ -655,11 +646,11 @@
         parse_term(SubTerm0, !PS),
         ( SubTerm0 = ok(SubTerm) ->
             conjunction_to_list(SubTerm, ArgTerms),
-            ( get_token(close_curly, !PS) ->
+            ( parser_get_token(close_curly, !PS) ->
                 Term = ok(term.functor(term.atom("{}"), ArgTerms,
                     TermContext))
             ;
-                unexpected("expecting `}' or operator", Term, !PS)
+                parser_unexpected("expecting `}' or operator", Term, !PS)
             )
         ;
             % Propagate error upwards.
@@ -687,7 +678,7 @@
     % extension is to provide a nicer syntax for higher-order stuff.
     (
         Term0 = ok(Term1),
-        get_token(open_ct, !PS)
+        parser_get_token(open_ct, !PS)
     ->
         get_term_context(!.PS, Context, TermContext),
         parse_args(Args0, !PS),
@@ -710,7 +701,7 @@
     state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
 parse_special_atom(Atom, TermContext, Term, !PS) :-
-    ( get_token(open_ct, !PS) ->
+    ( parser_get_token(open_ct, !PS) ->
         parse_args(Args0, !PS),
         (
             Args0 = ok(Args),
@@ -732,7 +723,7 @@
     ( Arg0 = ok(Arg) ->
         parse_list_2(Arg, List, !PS)
     ;
-        % propagate error
+        % Propagate error.
         List = Arg0
     ).
 
@@ -740,7 +731,7 @@
     state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
 parse_list_2(Arg, List, !PS) :-
-    ( get_token(Token, Context, !PS) ->
+    ( parser_get_token_context(Token, Context, !PS) ->
         get_term_context(!.PS, Context, TermContext),
         ( Token = comma ->
             parse_list(Tail0, !PS),
@@ -754,11 +745,11 @@
         ; Token = ht_sep ->
             parse_arg(Tail0, !PS),
             ( Tail0 = ok(Tail) ->
-                ( get_token(close_list, !PS) ->
+                ( parser_get_token(close_list, !PS) ->
                     List = ok(term.functor(term.atom("[|]"), [Arg, Tail],
                         TermContext))
                 ;
-                    unexpected("expecting ']' or operator", List, !PS)
+                    parser_unexpected("expecting ']' or operator", List, !PS)
                 )
             ;
                 % Propagate error.
@@ -769,13 +760,12 @@
             List = ok(term.functor(term.atom("[|]"), [Arg, Tail],
                 TermContext))
         ;
-            unexpected_tok(Token, Context,
+            parser_unexpected_tok(Token, Context,
                 "expected comma, `|', `]', or operator", List, !PS)
         )
     ;
-        % XXX The error message should state the line that the
-        % list started on.
-        error(!.PS, "unexpected end-of-file in list", List)
+        % XXX The error message should state the line that the list started on.
+        List = make_error(!.PS, "unexpected end-of-file in list")
     ).
 
 :- pred parse_args(parse(list(term(T)))::out,
@@ -785,7 +775,7 @@
     parse_arg(Arg0, !PS),
     (
         Arg0 = ok(Arg),
-        ( get_token(Token, Context, !PS) ->
+        ( parser_get_token_context(Token, Context, !PS) ->
             ( Token = comma ->
                 parse_args(Tail0, !PS),
                 ( Tail0 = ok(Tail) ->
@@ -797,11 +787,11 @@
             ; Token = close ->
                 List = ok([Arg])
             ;
-                unexpected_tok(Token, Context,
+                parser_unexpected_tok(Token, Context,
                     "expected `,', `)', or operator", List, !PS)
             )
         ;
-            error(!.PS, "unexpected end-of-file in argument list", List)
+            List = make_error(!.PS, "unexpected end-of-file in argument list")
         )
     ;
         Arg0 = error(Message, Tokens),
@@ -835,8 +825,7 @@
 :- func parser_state_get_ops_table(state(Ops, T)) = Ops.
 :- func parser_state_get_varset(state(Ops, T)) = varset(T).
 :- func parser_state_get_tokens_left(state(Ops, T)) = token_list.
-:- func parser_state_get_var_names(state(Ops, T)) =
-    map(string, var(T)).
+:- func parser_state_get_var_names(state(Ops, T)) = map(string, var(T)).
 
 :- func parser_state_set_varset(state(Ops, T), varset(T))
     = state(Ops, T).
@@ -878,24 +867,24 @@
     % must have been an operator precedence error. Otherwise, it was some
     % other sort of error, so issue the usual error message.
     %
-:- pred unexpected(string::in, parse(U)::out,
+:- pred parser_unexpected(string::in, parse(U)::out,
     state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-unexpected(UsualMessage, Error, !PS) :-
-    ( get_token(Token, Context, !PS) ->
-        unexpected_tok(Token, Context, UsualMessage, Error, !PS)
+parser_unexpected(UsualMessage, Error, !PS) :-
+    ( parser_get_token_context(Token, Context, !PS) ->
+        parser_unexpected_tok(Token, Context, UsualMessage, Error, !PS)
     ;
-        error(!.PS, UsualMessage, Error)
+        Error = make_error(!.PS, UsualMessage)
     ).
 
-:- pred unexpected_tok(token::in, token_context::in, string::in,
+:- pred parser_unexpected_tok(token::in, token_context::in, string::in,
     parse(U)::out,
     state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-unexpected_tok(Token, Context, UsualMessage, Error, !PS) :-
+parser_unexpected_tok(Token, Context, UsualMessage, Error, !PS) :-
     % Push the token back, so that the error message points at it
     % rather than at the following token.
-    unget_token(Token, Context, !PS),
+    parser_unget_token(Token, Context, !PS),
     (
         ( Token = name(Op)
         ; Token = comma, Op = ","
@@ -905,17 +894,16 @@
         ; ops.lookup_postfix_op(OpTable, Op, _, _)
         )
     ->
-        error(!.PS, "operator precedence error", Error)
+        Error = make_error(!.PS, "operator precedence error")
     ;
-        error(!.PS, UsualMessage, Error)
+        Error = make_error(!.PS, UsualMessage)
     ).
 
 %-----------------------------------------------------------------------------%
 
-:- pred error(state(Ops, T)::in, string::in, parse(U)::out)
-    is det.
+:- func make_error(state(Ops, T), string) = parse(U).
 
-error(ParserState, Message, error(Message, Tokens)) :-
+make_error(ParserState, Message) = error(Message, Tokens) :-
     Tokens = parser_state_get_tokens_left(ParserState).
 
 %-----------------------------------------------------------------------------%
@@ -945,55 +933,55 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred init_state(Ops::in, string::in, token_list::in,
+:- pred init_parser_state(Ops::in, string::in, token_list::in,
     state(Ops, T)::out) is det <= op_table(Ops).
 
-init_state(Ops, FileName, Tokens, ParserState) :-
+init_parser_state(Ops, FileName, Tokens, ParserState) :-
     varset.init(VarSet),
     map.init(Names),
     ParserState = state(FileName, Ops, VarSet, Tokens, Names).
 
-:- pred final_state(state(Ops, T)::in, varset(T)::out,
+:- pred final_parser_state(state(Ops, T)::in, varset(T)::out,
     token_list::out) is det.
 
-final_state(ParserState, VarSet, TokenList) :-
+final_parser_state(ParserState, VarSet, TokenList) :-
     VarSet = parser_state_get_varset(ParserState),
     TokenList = parser_state_get_tokens_left(ParserState).
 
 %-----------------------------------------------------------------------------%
 
-:- pred get_token(token::out,
+:- pred parser_get_token(token::out,
     state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-get_token(Token, !PS) :-
-    get_token(Token, _Context, !PS).
+parser_get_token(Token, !PS) :-
+    parser_get_token_context(Token, _Context, !PS).
 
-:- pred get_token(token::out, token_context::out,
+:- pred parser_get_token_context(token::out, token_context::out,
     state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-get_token(Token, Context, ParserState0, ParserState) :-
+parser_get_token_context(Token, Context, ParserState0, ParserState) :-
     Tokens0 = parser_state_get_tokens_left(ParserState0),
     Tokens0 = token_cons(Token, Context, Tokens),
     ParserState = parser_state_set_tokens_left(ParserState0, Tokens).
 
-:- pred unget_token(token::in, token_context::in,
+:- pred parser_unget_token(token::in, token_context::in,
     state(Ops, T)::in, state(Ops, T)::out) is det.
 
-unget_token(Token, Context, ParserState0, ParserState) :-
+parser_unget_token(Token, Context, ParserState0, ParserState) :-
     Tokens0 = parser_state_get_tokens_left(ParserState0),
     Tokens = token_cons(Token, Context, Tokens0),
     ParserState = parser_state_set_tokens_left(ParserState0, Tokens).
 
-:- pred peek_token(token::out,
+:- pred parser_peek_token(token::out,
     state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-peek_token(Token, !PS) :-
-    peek_token(Token, _Context, !PS).
+parser_peek_token(Token, !PS) :-
+    parser_peek_token_context(Token, _Context, !PS).
 
-:- pred peek_token(token::out, token_context::out,
+:- pred parser_peek_token_context(token::out, token_context::out,
     state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-peek_token(Token, Context, ParserState, ParserState) :-
+parser_peek_token_context(Token, Context, ParserState, ParserState) :-
     Tokens = parser_state_get_tokens_left(ParserState),
     Tokens = token_cons(Token, Context, _).
 
Index: library/pprint.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/pprint.m,v
retrieving revision 1.24
diff -u -b -r1.24 pprint.m
--- library/pprint.m	22 Aug 2006 02:33:41 -0000	1.24
+++ library/pprint.m	19 Sep 2006 15:13:17 -0000
@@ -642,7 +642,7 @@
 
 word_wrapped(String) =
     packed(space, list.map(func(Word) = text(Word),
-                            string.words(char.is_whitespace, String))).
+        string.words_separator(char.is_whitespace, String))).
 
 %-----------------------------------------------------------------------------%
 
Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.249
diff -u -b -r1.249 string.m
--- library/string.m	31 Aug 2006 11:09:52 -0000	1.249
+++ library/string.m	19 Sep 2006 14:58:25 -0000
@@ -88,9 +88,9 @@
 
     % As above, but using the supplied table of operators.
     %
-:- func string.string(ops.table, T) = string.
+:- func string.string_ops(ops.table, T) = string.
 
-    % string.string(NonCanon, OpsTable, X, String)
+    % string.string_ops_noncanon(NonCanon, OpsTable, X, String)
     %
     % As above, but the caller specifies what behaviour should occur for
     % non-canonical terms (i.e. terms where multiple representations
@@ -103,11 +103,13 @@
     % - `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(deconstruct.noncanon_handling, ops.table, T, string).
-:- mode string.string(in(do_not_allow), in, in, out) is det.
-:- mode string.string(in(canonicalize), in, in, out) is det.
-:- mode string.string(in(include_details_cc), in, in, out) is cc_multi.
-:- mode string.string(in, in, in, out) is cc_multi.
+:- pred string.string_ops_noncanon(deconstruct.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)
+    is cc_multi.
+:- mode string.string_ops_noncanon(in, in, in, out) is cc_multi.
 
     % string.char_to_string(Char, String).
     % Converts a character (single-character atom) to a string or vice versa.
@@ -303,15 +305,15 @@
 
     % True if string contains only alphabetic characters (letters).
     %
-:- pred string.is_alpha(string::in) is semidet.
+:- pred string.is_all_alpha(string::in) is semidet.
 
     % True if string contains only alphabetic characters and underscores.
     %
-:- pred string.is_alpha_or_underscore(string::in) is semidet.
+:- pred string.is_all_alpha_or_underscore(string::in) is semidet.
 
     % True if string contains only letters, digits, and underscores.
     %
-:- pred string.is_alnum_or_underscore(string::in) is semidet.
+:- pred string.is_all_alnum_or_underscore(string::in) is semidet.
 
     % string.pad_left(String0, PadChar, Width, String):
     % Insert `PadChar's at the left of `String0' until it is at least as long
@@ -394,18 +396,18 @@
     %
 :- func string.strip(string) = string.
 
-    % string.lstrip(Pred, String):
+    % string.lstrip_pred(Pred, String):
     % `String' minus the maximal prefix consisting entirely of chars
     % satisfying `Pred'.
     %
-:- func string.lstrip(pred(char)::in(pred(in) is semidet), string::in)
+:- func string.lstrip_pred(pred(char)::in(pred(in) is semidet), string::in)
     = (string::out) is det.
 
-    % string.rstrip(Pred, String):
+    % string.rstrip_pred(Pred, String):
     % `String' minus the maximal suffix consisting entirely of chars
     % satisfying `Pred'.
     %
-:- func string.rstrip(pred(char)::in(pred(in) is semidet), string::in)
+:- func string.rstrip_pred(pred(char)::in(pred(in) is semidet), string::in)
     = (string::out) is det.
 
     % string.prefix_length(Pred, String):
@@ -560,17 +562,18 @@
 :- mode string.foldr_substring(pred(in, in, out) is multi, in, in, in,
     in, out) is multi.
 
-    % string.words(SepP, String) returns the list of non-empty substrings
-    % of String (in first to last order) that are delimited by non-empty
-    % sequences of chars matched by SepP. For example,
+    % string.words_separator(SepP, String) returns the list of non-empty
+    % substrings of String (in first to last order) that are delimited
+    % by non-empty sequences of chars matched by SepP. For example,
     %
-    % string.words(char.is_whitespace, " the cat  sat on the  mat") =
+    % string.words_separator(char.is_whitespace, " the cat  sat on the  mat") =
     %   ["the", "cat", "sat", "on", "the", "mat"]
     %
-:- func string.words(pred(char), string) = list(string).
-:- mode string.words(pred(in) is semidet, in) = out is det.
+:- func string.words_separator(pred(char), string) = list(string).
+:- mode string.words_separator(pred(in) is semidet, in) = out is det.
 
-    % string.words(String) = string.words(char.is_whitespace, String).
+    % string.words(String) =
+    %   string.words_separator(char.is_whitespace, String).
     %
 :- func string.words(string) = list(string).
 
@@ -649,12 +652,13 @@
     %
 :- pred string.sub_string_search(string::in, string::in, int::out) is semidet.
 
-    % string.sub_string_search(String, SubString, BeginAt, Index).
+    % string.sub_string_search_start(String, SubString, BeginAt, Index).
     % `Index' is the position in `String' where the first occurrence of
     % `SubString' occurs such that 'Index' is greater than or equal to
     % `BeginAt'.  Indices start at zero,
     %
-:- pred string.sub_string_search(string::in, string::in, int::in, int::out)
+:- pred string.sub_string_search_start(string::in, string::in, int::in,
+    int::out)
     is semidet.
 
     % A function similar to sprintf() in C.
@@ -748,13 +752,13 @@
     %
 :- func string.word_wrap(string, int) = string.
 
-    % word_wrap(Str, N, WordSeparator) = Wrapped.
-    % word_wrap/3 is like word_wrap/2, except that words that need to be broken
-    % up over multiple lines have WordSeparator inserted between each piece.
-    % If the length of WordSeparator is greater that or equal to N, then
-    % no separator is used.
+    % word_wrap_separator(Str, N, WordSeparator) = Wrapped.
+    % word_wrap_separator/3 is like word_wrap/2, except that words that
+    % need to be broken up over multiple lines have WordSeparator inserted
+    % between each piece. If the length of WordSeparator is greater than
+    % or equal to N, then no separator is used.
     %
-:- func string.word_wrap(string, int, string) = string.
+:- func string.word_wrap_separator(string, int, string) = string.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -795,20 +799,20 @@
         Result = append_list([Subst | list.reverse(Foldl)])
     ;
         PatLength = string.length(Pat),
-        ReversedChunks = replace_all(Str, Pat, Subst, PatLength, 0, []),
+        ReversedChunks = replace_all_2(Str, Pat, Subst, PatLength, 0, []),
         Chunks = list.reverse(ReversedChunks),
         Result = string.append_list(Chunks)
     ).
 
-:- func string.replace_all(string, string, string, int, int, list(string))
+:- func string.replace_all_2(string, string, string, int, int, list(string))
     = list(string).
 
-string.replace_all(Str, Pat, Subst, PatLength, BeginAt, Result0) = Result :-
-    ( sub_string_search(Str, Pat, BeginAt, Index) ->
+string.replace_all_2(Str, Pat, Subst, PatLength, BeginAt, Result0) = Result :-
+    ( sub_string_search_start(Str, Pat, BeginAt, Index) ->
         Length = Index - BeginAt,
         Initial = string.unsafe_substring(Str, BeginAt, Length),
         Start = Index + PatLength,
-        Result = string.replace_all(Str, Pat, Subst, PatLength, Start,
+        Result = string.replace_all_2(Str, Pat, Subst, PatLength, Start,
             [Subst, Initial | Result0])
     ;
         Length = string.length(Str) - BeginAt,
@@ -1356,13 +1360,13 @@
         true
     ).
 
-string.is_alpha(S) :-
+string.is_all_alpha(S) :-
     string.all_match(char.is_alpha, S).
 
-string.is_alpha_or_underscore(S) :-
+string.is_all_alpha_or_underscore(S) :-
     string.all_match(char.is_alpha_or_underscore, S).
 
-string.is_alnum_or_underscore(S) :-
+string.is_all_alnum_or_underscore(S) :-
     string.all_match(char.is_alnum_or_underscore, S).
 
 string.pad_left(String0, PadChar, Width, String) :-
@@ -1522,10 +1526,11 @@
 %-----------------------------------------------------------------------------%
 
 string.sub_string_search(WholeString, Pattern, Index) :-
-    sub_string_search(WholeString, Pattern, 0, Index).
+    sub_string_search_start(WholeString, Pattern, 0, Index).
 
 :- pragma foreign_proc("C",
-    sub_string_search(WholeString::in, Pattern::in, BeginAt::in, Index::out),
+    sub_string_search_start(WholeString::in, Pattern::in, BeginAt::in,
+        Index::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
 "{
     char *match;
@@ -1539,7 +1544,8 @@
 }").
 
 :- pragma foreign_proc("C#",
-    sub_string_search(WholeString::in, Pattern::in, BeginAt::in, Index::out),
+    sub_string_search_start(WholeString::in, Pattern::in, BeginAt::in,
+        Index::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "{
     Index = WholeString.IndexOf(Pattern, BeginAt);
@@ -1547,17 +1553,17 @@
 }").
 
 % This is only used if there is no matching foreign_proc definition
-sub_string_search(String, SubString, BeginAt, Index) :-
-    sub_string_search_2(String, SubString, BeginAt, length(String),
+sub_string_search_start(String, SubString, BeginAt, Index) :-
+    sub_string_search_start_2(String, SubString, BeginAt, length(String),
         length(SubString), Index).
 
     % Brute force string searching. For short Strings this is good;
     % for longer strings Boyer-Moore is much better.
     %
-:- pred sub_string_search_2(string::in, string::in, int::in, int::in, int::in,
-    int::out) is semidet.
+:- pred sub_string_search_start_2(string::in, string::in, int::in, int::in,
+    int::in, int::out) is semidet.
 
-sub_string_search_2(String, SubString, I, Length, SubLength, Index) :-
+sub_string_search_start_2(String, SubString, I, Length, SubLength, Index) :-
     I < Length,
     (
         % XXX This is inefficient -- there is no (in, in, in) = in is semidet
@@ -1568,7 +1574,8 @@
     ->
         Index = I
     ;
-        sub_string_search_2(String, SubString, I + 1, Length, SubLength, Index)
+        sub_string_search_start_2(String, SubString, I + 1, Length, SubLength,
+            Index)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -2960,14 +2967,14 @@
 :- pred split_at_exponent(string::in, string::out, string::out) is det.
 
 split_at_exponent(Str, Float, Exponent) :-
-    FloatAndExponent = string.words(is_exponent, Str),
+    FloatAndExponent = string.words_separator(is_exponent, Str),
     list.index0_det(FloatAndExponent, 0, Float),
     list.index0_det(FloatAndExponent, 1, Exponent).
 
 :- pred split_at_decimal_point(string::in, string::out, string::out) is det.
 
 split_at_decimal_point(Str, Mantissa, Fraction) :-
-    MantAndFrac = string.words(is_decimal_point, Str),
+    MantAndFrac = string.words_separator(is_decimal_point, Str),
     list.index0_det(MantAndFrac, 0, Mantissa),
     ( list.index0(MantAndFrac, 1, Fraction0) ->
         Fraction = Fraction0
@@ -4052,7 +4059,7 @@
 
 %------------------------------------------------------------------------------%
 
-string.words(SepP, String) = Words :-
+string.words_separator(SepP, String) = Words :-
     I = preceding_boundary(isnt(SepP), String, string.length(String) - 1),
     Words = words_2(SepP, String, I, []).
 
@@ -4074,7 +4081,7 @@
 
 %------------------------------------------------------------------------------%
 
-string.words(String) = string.words(char.is_whitespace, String).
+string.words(String) = string.words_separator(char.is_whitespace, String).
 
 %------------------------------------------------------------------------------%
 
@@ -4124,11 +4131,11 @@
 
 %-----------------------------------------------------------------------------%
 
-rstrip(S) = rstrip(is_whitespace, S).
+rstrip(S) = rstrip_pred(is_whitespace, S).
 
 %-----------------------------------------------------------------------------%
 
-lstrip(S) = lstrip(is_whitespace, S).
+lstrip(S) = lstrip_pred(is_whitespace, S).
 
 %-----------------------------------------------------------------------------%
 
@@ -4139,11 +4146,11 @@
 
 %-----------------------------------------------------------------------------%
 
-rstrip(P, S) = left(S, length(S) - suffix_length(P, S)).
+rstrip_pred(P, S) = left(S, length(S) - suffix_length(P, S)).
 
 %-----------------------------------------------------------------------------%
 
-lstrip(P, S) = right(S, length(S) - prefix_length(P, S)).
+lstrip_pred(P, S) = right(S, length(S) - prefix_length(P, S)).
 
 %-----------------------------------------------------------------------------%
 
@@ -4199,12 +4206,13 @@
 % Various different versions of univ_to_string.
 
 string.string(Univ) = String :-
-    string.string(canonicalize, ops.init_mercury_op_table, Univ, String).
+    string.string_ops_noncanon(canonicalize, ops.init_mercury_op_table,
+        Univ, String).
 
-string.string(OpsTable, Univ) = String :-
-    string.string(canonicalize, OpsTable, Univ, String).
+string.string_ops(OpsTable, Univ) = String :-
+    string.string_ops_noncanon(canonicalize, OpsTable, Univ, String).
 
-string.string(NonCanon, OpsTable, X, String) :-
+string.string_ops_noncanon(NonCanon, OpsTable, X, String) :-
     value_to_revstrings(NonCanon, OpsTable, X, [], RevStrings),
     String = string.append_list(list.reverse(RevStrings)).
 
@@ -4218,22 +4226,22 @@
 
 value_to_revstrings(NonCanon, OpsTable, X, !Rs) :-
     Priority = ops.max_priority(OpsTable) + 1,
-    value_to_revstrings(NonCanon, OpsTable, Priority, X, !Rs).
+    value_to_revstrings_prio(NonCanon, OpsTable, Priority, X, !Rs).
 
-:- pred value_to_revstrings(deconstruct.noncanon_handling,
+:- pred value_to_revstrings_prio(deconstruct.noncanon_handling,
     ops.table, ops.priority, T, revstrings, revstrings).
-:- mode value_to_revstrings(in(do_not_allow), in, in, in, in, out) is det.
-:- mode value_to_revstrings(in(canonicalize), in, in, in, in, out) is det.
-:- mode value_to_revstrings(in(include_details_cc), in, in, in, in, out)
+:- 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)
     is cc_multi.
-:- mode value_to_revstrings(in, in, in, in, in, out) is cc_multi.
+:- mode value_to_revstrings_prio(in, in, in, in, in, out) is cc_multi.
 
-value_to_revstrings(NonCanon, OpsTable, Priority, X, !Rs) :-
+value_to_revstrings_prio(NonCanon, OpsTable, Priority, X, !Rs) :-
     %
     % we need to special-case the builtin types:
     %   int, char, float, string
     %   type_info, univ, c_pointer, array
-    %   and private_builtin:type_info
+    %   and private_builtin.type_info
     %
     ( dynamic_cast(X, String) ->
         add_revstring(term_io.quoted_string(String), !Rs)
@@ -4350,7 +4358,7 @@
         add_revstring(term_io.quoted_atom(Functor), !Rs),
         add_revstring(" ", !Rs),
         adjust_priority(OpPriority, OpAssoc, NewPriority),
-        value_to_revstrings(NonCanon, OpsTable, NewPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, NewPriority,
             univ_value(PrefixArg), !Rs),
         maybe_add_revstring(")", Priority, OpPriority, !Rs)
     ;
@@ -4359,7 +4367,7 @@
     ->
         maybe_add_revstring("(", Priority, OpPriority, !Rs),
         adjust_priority(OpPriority, OpAssoc, NewPriority),
-        value_to_revstrings(NonCanon, OpsTable, NewPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, NewPriority,
             univ_value(PostfixArg), !Rs),
         add_revstring(" ", !Rs),
         add_revstring(term_io.quoted_atom(Functor), !Rs),
@@ -4371,7 +4379,7 @@
     ->
         maybe_add_revstring("(", Priority, OpPriority, !Rs),
         adjust_priority(OpPriority, LeftAssoc, LeftPriority),
-        value_to_revstrings(NonCanon, OpsTable, LeftPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, LeftPriority,
             univ_value(Arg1), !Rs),
         ( Functor = "," ->
             add_revstring(", ", !Rs)
@@ -4381,7 +4389,7 @@
             add_revstring(" ", !Rs)
         ),
         adjust_priority(OpPriority, RightAssoc, RightPriority),
-        value_to_revstrings(NonCanon, OpsTable, RightPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, RightPriority,
             univ_value(Arg2), !Rs),
         maybe_add_revstring(")", Priority, OpPriority, !Rs)
     ;
@@ -4393,11 +4401,11 @@
         add_revstring(term_io.quoted_atom(Functor), !Rs),
         add_revstring(" ", !Rs),
         adjust_priority(OpPriority, FirstAssoc, FirstPriority),
-        value_to_revstrings(NonCanon, OpsTable, FirstPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, FirstPriority,
             univ_value(Arg1), !Rs),
         add_revstring(" ", !Rs),
         adjust_priority(OpPriority, SecondAssoc, SecondPriority),
-        value_to_revstrings(NonCanon, OpsTable, SecondPriority,
+        value_to_revstrings_prio(NonCanon, OpsTable, SecondPriority,
             univ_value(Arg2), !Rs),
         maybe_add_revstring(")", Priority, OpPriority, !Rs)
     ;
@@ -4411,7 +4419,7 @@
             add_revstring(")", !Rs)
         ;
             add_revstring(
-                term_io.quoted_atom(Functor,
+                term_io.quoted_atom_agt(Functor,
                     term_io.maybe_adjacent_to_graphic_token),
                 !Rs
             )
@@ -4496,7 +4504,7 @@
 
 arg_to_revstrings(NonCanon, OpsTable, X, !Rs) :-
     Priority = comma_priority(OpsTable),
-    value_to_revstrings(NonCanon, OpsTable, Priority, univ_value(X), !Rs).
+    value_to_revstrings_prio(NonCanon, OpsTable, Priority, univ_value(X), !Rs).
 
 :- func comma_priority(ops.table) = ops.priority.
 
@@ -4644,15 +4652,15 @@
 
 %-----------------------------------------------------------------------------%
 
-string.word_wrap(Str, N) = string.word_wrap(Str, N, "").
+word_wrap(Str, N) = word_wrap_separator(Str, N, "").
 
-string.word_wrap(Str, N, WordSep) = Wrapped :-
-    Words = string.words(char.is_whitespace, Str),
+word_wrap_separator(Str, N, WordSep) = Wrapped :-
+    Words = string.words_separator(char.is_whitespace, Str),
     SepLen = string.length(WordSep),
     ( SepLen < N ->
-        string.word_wrap_2(Words, WordSep, SepLen, 1, N, [], Wrapped)
+        word_wrap_2(Words, WordSep, SepLen, 1, N, [], Wrapped)
     ;
-        string.word_wrap_2(Words, "", 0, 1, N, [], Wrapped)
+        word_wrap_2(Words, "", 0, 1, N, [], Wrapped)
     ).
 
 :- pred word_wrap_2(list(string)::in, string::in, int::in, int::in, int::in,
Index: library/term.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term.m,v
retrieving revision 1.121
diff -u -b -r1.121 term.m
--- library/term.m	20 Aug 2006 08:17:45 -0000	1.121
+++ library/term.m	19 Sep 2006 12:35:21 -0000
@@ -171,33 +171,33 @@
 :- type substitution(T) == map(var(T), term(T)).
 :- type substitution    == substitution(generic).
 
-    % unify(Term1, Term2, Bindings0, Bindings):
+    % unify_term(Term1, Term2, Bindings0, Bindings):
     %
     % Unify (with occur check) two terms with respect to a set of bindings
     % and possibly update the set of bindings.
     %
-:- pred unify(term(T)::in, term(T)::in, substitution(T)::in,
+:- pred unify_term(term(T)::in, term(T)::in, substitution(T)::in,
     substitution(T)::out) is semidet.
 
     % As above, but unify the corresponding elements of two lists of terms.
     % Fails if the lists are not of equal length.
     %
-:- pred unify_list(list(term(T))::in, list(term(T))::in,
+:- pred unify_term_list(list(term(T))::in, list(term(T))::in,
     substitution(T)::in, substitution(T)::out) is semidet.
 
-    % unify(Term1, Term2, BoundVars, !Bindings):
+    % unify_d_termont_bind(Term1, Term2, BoundVars, !Bindings):
     %
     % Unify (with occur check) two terms with respect to a set of bindings
     % and possibly update the set of bindings. Fails if any of the variables
     % in BoundVars would become bound by the unification.
     %
-:- pred unify(term(T)::in, term(T)::in, list(var(T))::in,
+:- pred unify_term_dont_bind(term(T)::in, term(T)::in, list(var(T))::in,
     substitution(T)::in, substitution(T)::out) is semidet.
 
     % As above, but unify the corresponding elements of two lists of terms.
     % Fails if the lists are not of equal length.
     %
-:- pred unify_list(list(term(T))::in, list(term(T))::in,
+:- pred unify_term_list_dont_bind(list(term(T))::in, list(term(T))::in,
     list(var(T))::in, substitution(T)::in, substitution(T)::out) is semidet.
 
     % list_subsumes(Terms1, Terms2, Subst) succeeds iff the list
@@ -327,10 +327,10 @@
 :- pred apply_variable_renaming_to_vars(map(var(T), var(T))::in,
     list(var(T))::in, list(var(T))::out) is det.
 
-    % is_ground(Term, Bindings) is true iff no variables contained
+    % is_ground_in_bindings(Term, Bindings) is true iff no variables contained
     % in Term are non-ground in Bindings.
     %
-:- pred is_ground(term(T)::in, substitution(T)::in) is semidet.
+:- pred is_ground_in_bindings(term(T)::in, substitution(T)::in) is semidet.
 
     % is_ground(Term) is true iff Term contains no variables.
     %
@@ -819,12 +819,12 @@
 
 %-----------------------------------------------------------------------------%
 
-term.unify(variable(X), variable(Y), !Bindings) :-
+unify_term(variable(X), variable(Y), !Bindings) :-
     ( map.search(!.Bindings, X, BindingOfX) ->
         ( map.search(!.Bindings, Y, BindingOfY) ->
             % Both X and Y already have bindings - just unify the terms
             % they are bound to.
-            term.unify(BindingOfX, BindingOfY, !Bindings)
+            unify_term(BindingOfX, BindingOfY, !Bindings)
         ;
             % Y is a variable which hasn't been bound yet.
             apply_rec_substitution(BindingOfX, !.Bindings, SubstBindingOfX),
@@ -856,40 +856,40 @@
         )
     ).
 
-term.unify(term.variable(X), term.functor(F, As, C), !Bindings) :-
+unify_term(term.variable(X), term.functor(F, As, C), !Bindings) :-
     ( map.search(!.Bindings, X, BindingOfX) ->
-        term.unify(BindingOfX, functor(F, As, C), !Bindings)
+        unify_term(BindingOfX, functor(F, As, C), !Bindings)
     ;
         \+ occurs_list(As, X, !.Bindings),
         map.set(!.Bindings, X, functor(F, As, C), !:Bindings)
     ).
 
-term.unify(functor(F, As, C), variable(X), !Bindings) :-
+unify_term(functor(F, As, C), variable(X), !Bindings) :-
     ( map.search(!.Bindings, X, BindingOfX) ->
-        term.unify(functor(F, As, C), BindingOfX, !Bindings)
+        unify_term(functor(F, As, C), BindingOfX, !Bindings)
     ;
         \+ occurs_list(As, X, !.Bindings),
         map.set(!.Bindings, X, functor(F, As, C), !:Bindings)
     ).
 
-term.unify(functor(F, AsX, _), functor(F, AsY, _), !Bindings) :-
-    term.unify_list(AsX, AsY, !Bindings).
+unify_term(functor(F, AsX, _), functor(F, AsY, _), !Bindings) :-
+    unify_term_list(AsX, AsY, !Bindings).
 
-term.unify_list([], [], !Bindings).
-term.unify_list([X | Xs], [Y | Ys], !Bindings) :-
-    term.unify(X, Y, !Bindings),
-    term.unify_list(Xs, Ys, !Bindings).
+unify_term_list([], [], !Bindings).
+unify_term_list([X | Xs], [Y | Ys], !Bindings) :-
+    unify_term(X, Y, !Bindings),
+    unify_term_list(Xs, Ys, !Bindings).
 
-term.unify(variable(X), variable(Y), BoundVars, !Bindings) :-
+unify_term_dont_bind(variable(X), variable(Y), BoundVars, !Bindings) :-
     ( list.member(Y, BoundVars) ->
-        unify_bound_var(X, Y, BoundVars, !Bindings)
+        unify_term_bound_var(X, Y, BoundVars, !Bindings)
     ; list.member(X, BoundVars) ->
-        unify_bound_var(Y, X, BoundVars, !Bindings)
+        unify_term_bound_var(Y, X, BoundVars, !Bindings)
     ; map.search(!.Bindings, X, BindingOfX) ->
         ( map.search(!.Bindings, Y, BindingOfY) ->
             % Both X and Y already have bindings - just unify the
             % terms they are bound to.
-            unify(BindingOfX, BindingOfY, BoundVars, !Bindings)
+            unify_term_dont_bind(BindingOfX, BindingOfY, BoundVars, !Bindings)
         ;
             apply_rec_substitution(BindingOfX, !.Bindings, SubstBindingOfX),
             % Y is a variable which hasn't been bound yet.
@@ -920,27 +920,27 @@
         )
     ).
 
-term.unify(variable(X), functor(F, As, C), BoundVars, !Bindings) :-
+unify_term_dont_bind(variable(X), functor(F, As, C), BoundVars, !Bindings) :-
     ( map.search(!.Bindings, X, BindingOfX) ->
-        term.unify(BindingOfX, functor(F, As, C), BoundVars, !Bindings)
+        unify_term_dont_bind(BindingOfX, functor(F, As, C), BoundVars,
+            !Bindings)
     ;
         \+ occurs_list(As, X, !.Bindings),
         \+ list.member(X, BoundVars),
         svmap.det_insert(X, functor(F, As, C), !Bindings)
     ).
 
-term.unify(functor(F, As, C), variable(X), BoundVars, !Bindings) :-
-    (
-        map.search(!.Bindings, X, BindingOfX)
-    ->
-        term.unify(functor(F, As, C), BindingOfX, BoundVars, !Bindings)
+unify_term_dont_bind(functor(F, As, C), variable(X), BoundVars, !Bindings) :-
+    ( map.search(!.Bindings, X, BindingOfX) ->
+        unify_term_dont_bind(functor(F, As, C), BindingOfX, BoundVars,
+            !Bindings)
     ;
         \+ occurs_list(As, X, !.Bindings),
         \+ list.member(X, BoundVars),
         svmap.det_insert(X, functor(F, As, C), !Bindings)
     ).
 
-term.unify(functor(FX, AsX, _CX), functor(FY, AsY, _CY), BoundVars,
+unify_term_dont_bind(functor(FX, AsX, _CX), functor(FY, AsY, _CY), BoundVars,
         !Bindings) :-
     list.length(AsX, ArityX),
     list.length(AsY, ArityY),
@@ -948,23 +948,23 @@
         FX = FY,
         ArityX = ArityY
     ->
-        term.unify_list(AsX, AsY, BoundVars, !Bindings)
+        unify_term_list_dont_bind(AsX, AsY, BoundVars, !Bindings)
     ;
         fail
     ).
 
-term.unify_list([], [], _, !Bindings).
-term.unify_list([X | Xs], [Y | Ys], BoundVars, !Bindings) :-
-    term.unify(X, Y, BoundVars, !Bindings),
-    term.unify_list(Xs, Ys, BoundVars, !Bindings).
+unify_term_list_dont_bind([], [], _, !Bindings).
+unify_term_list_dont_bind([X | Xs], [Y | Ys], BoundVars, !Bindings) :-
+    unify_term_dont_bind(X, Y, BoundVars, !Bindings),
+    unify_term_list_dont_bind(Xs, Ys, BoundVars, !Bindings).
 
-:- pred unify_bound_var(var(T)::in, var(T)::in, list(var(T))::in,
+:- pred unify_term_bound_var(var(T)::in, var(T)::in, list(var(T))::in,
     substitution(T)::in, substitution(T)::out) is semidet.
 
-unify_bound_var(Var, BoundVar, BoundVars, !Bindings) :-
+unify_term_bound_var(Var, BoundVar, BoundVars, !Bindings) :-
     ( map.search(!.Bindings, Var, BindingOfVar) ->
         BindingOfVar = variable(Var2),
-        unify_bound_var(Var2, BoundVar, BoundVars, !Bindings)
+        unify_term_bound_var(Var2, BoundVar, BoundVars, !Bindings)
     ;
         ( Var = BoundVar ->
             true
@@ -979,7 +979,7 @@
     % without binding any of the variables in Terms2.
     vars_list(Terms2, Terms2Vars),
     map.init(Subst0),
-    term.unify_list(Terms1, Terms2, Terms2Vars, Subst0, Subst).
+    unify_term_list_dont_bind(Terms1, Terms2, Terms2Vars, Subst0, Subst).
 
 %-----------------------------------------------------------------------------%
 
@@ -1163,30 +1163,31 @@
 
 %-----------------------------------------------------------------------------%
 
-is_ground(variable(V), Bindings) :-
+is_ground_in_bindings(variable(V), Bindings) :-
     map.search(Bindings, V, Binding),
-    is_ground(Binding, Bindings).
-is_ground(functor(_, Args, _), Bindings) :-
-    is_ground_2(Args, Bindings).
-
-:- pred is_ground_2(list(term(T))::in, substitution(T)::in) is semidet.
-
-is_ground_2([], _Bindings).
-is_ground_2([Term | Terms], Bindings) :-
-    is_ground(Term, Bindings),
-    is_ground_2(Terms, Bindings).
+    is_ground_in_bindings(Binding, Bindings).
+is_ground_in_bindings(functor(_, Args, _), Bindings) :-
+    is_ground_in_bindings_list(Args, Bindings).
+
+:- pred is_ground_in_bindings_list(list(term(T))::in, substitution(T)::in)
+    is semidet.
+
+is_ground_in_bindings_list([], _Bindings).
+is_ground_in_bindings_list([Term | Terms], Bindings) :-
+    is_ground_in_bindings(Term, Bindings),
+    is_ground_in_bindings_list(Terms, Bindings).
 
 %-----------------------------------------------------------------------------%
 
 is_ground(functor(_, Args, _)) :-
-    is_ground_2(Args).
+    is_ground_list(Args).
 
-:- pred is_ground_2(list(term(T))::in) is semidet.
+:- pred is_ground_list(list(term(T))::in) is semidet.
 
-is_ground_2([]).
-is_ground_2([Term | Terms]) :-
+is_ground_list([]).
+is_ground_list([Term | Terms]) :-
     is_ground(Term),
-    is_ground_2(Terms).
+    is_ground_list(Terms).
 
 %-----------------------------------------------------------------------------%
 
Index: library/term_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term_io.m,v
retrieving revision 1.80
diff -u -b -r1.80 term_io.m
--- library/term_io.m	27 Jul 2006 05:03:39 -0000	1.80
+++ library/term_io.m	19 Sep 2006 15:12:18 -0000
@@ -161,18 +161,34 @@
 % and will not be included in the Mercury library reference manual.
 
 %-----------------------------------------------------------------------------%
+
 :- interface.
 
+    % Convert a character to the corresponding octal escape code.
+    %
+    % We use ISO-Prolog style octal escapes, which are of the form '\nnn\';
+    % note that unlike C octal escapes, they are terminated with a backslash.
+    %
+    % XXX Using this predicate in the compiler may cause problems interfacing
+    % with versions of the compiler that have been built in grades which use
+    % different character representations.
+    %
+:- func mercury_escape_char(char) = string.
+
+    % Succeed if the given character is a Mercury punctuation character.
+    %
+:- pred is_mercury_punctuation_char(char::in) is semidet.
+
     % for use by io.m.
 
 :- type adjacent_to_graphic_token
     --->    maybe_adjacent_to_graphic_token
     ;       not_adjacent_to_graphic_token.
 
-:- pred term_io.quote_atom(string::in, adjacent_to_graphic_token::in,
+:- pred term_io.quote_atom_agt(string::in, adjacent_to_graphic_token::in,
     io::di, io::uo) is det.
 
-:- func term_io.quoted_atom(string, adjacent_to_graphic_token) = string.
+:- func term_io.quoted_atom_agt(string, adjacent_to_graphic_token) = string.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -480,22 +496,22 @@
 term_io.write_constant(term.float(F), _, !IO) :-
     io.write_float(F, !IO).
 term_io.write_constant(term.atom(A), NextToGraphicToken, !IO) :-
-    term_io.quote_atom(A, NextToGraphicToken, !IO).
+    term_io.quote_atom_agt(A, NextToGraphicToken, !IO).
 term_io.write_constant(term.string(S), _, !IO) :-
     term_io.quote_string(S, !IO).
 
 term_io.format_constant(Const) =
-    term_io.format_constant(Const, not_adjacent_to_graphic_token).
+    term_io.format_constant_agt(Const, not_adjacent_to_graphic_token).
 
-:- func term_io.format_constant(const, adjacent_to_graphic_token) = string.
+:- func term_io.format_constant_agt(const, adjacent_to_graphic_token) = string.
 
-term_io.format_constant(term.integer(I), _) =
+term_io.format_constant_agt(term.integer(I), _) =
     string.int_to_string(I).
-term_io.format_constant(term.float(F), _) =
+term_io.format_constant_agt(term.float(F), _) =
     string.float_to_string(F).
-term_io.format_constant(term.atom(A), NextToGraphicToken) =
-    term_io.quoted_atom(A, NextToGraphicToken).
-term_io.format_constant(term.string(S), _) =
+term_io.format_constant_agt(term.atom(A), NextToGraphicToken) =
+    term_io.quoted_atom_agt(A, NextToGraphicToken).
+term_io.format_constant_agt(term.string(S), _) =
     term_io.quoted_string(S).
 
 %-----------------------------------------------------------------------------%
@@ -507,12 +523,12 @@
     string.format("'%s'", [s(term_io.escaped_char(C))]).
 
 term_io.quote_atom(S, !IO) :-
-    term_io.quote_atom(S, not_adjacent_to_graphic_token, !IO).
+    term_io.quote_atom_agt(S, not_adjacent_to_graphic_token, !IO).
 
 term_io.quoted_atom(S) =
-    term_io.quoted_atom(S, not_adjacent_to_graphic_token).
+    term_io.quoted_atom_agt(S, not_adjacent_to_graphic_token).
 
-term_io.quote_atom(S, NextToGraphicToken, !IO) :-
+term_io.quote_atom_agt(S, NextToGraphicToken, !IO) :-
     ShouldQuote = should_atom_be_quoted(S, NextToGraphicToken),
     (
         ShouldQuote = no,
@@ -524,7 +540,7 @@
         io.write_char('''', !IO)
     ).
 
-term_io.quoted_atom(S, NextToGraphicToken) = String :-
+term_io.quoted_atom_agt(S, NextToGraphicToken) = String :-
     ShouldQuote = should_atom_be_quoted(S, NextToGraphicToken),
     (
         ShouldQuote = no,
@@ -544,7 +560,7 @@
             % Letter digit token (6.4.2)
             string.first_char(S, FirstChar, Rest),
             char.is_lower(FirstChar),
-            string.is_alnum_or_underscore(Rest)
+            string.is_all_alnum_or_underscore(Rest)
         ;
             % Semicolon token (6.4.2)
             S = ";"
@@ -638,16 +654,6 @@
         String = mercury_escape_char(Char)
     ).
 
-    % Convert a character to the corresponding octal escape code.
-    %
-    % We use ISO-Prolog style octal escapes, which are of the form '\nnn\';
-    % note that unlike C octal escapes, they are terminated with a backslash.
-    %
-    % Note: the code here is similar to code in compiler/mercury_to_mercury.m;
-    % any changes here may require similar changes there.
-    %
-:- func mercury_escape_char(char) = string.
-
 mercury_escape_char(Char) = EscapeCode :-
     char.to_int(Char, Int),
     string.int_to_base_string(Int, 8, OctalString0),
@@ -663,22 +669,15 @@
 :- pred is_mercury_source_char(char::in) is semidet.
 
 is_mercury_source_char(Char) :-
-    ( char.is_alnum(Char) ->
-        true
-    ; is_mercury_punctuation_char(Char) ->
-        true
-    ;
-        fail
+    ( char.is_alnum(Char)
+    ; is_mercury_punctuation_char(Char)
     ).
 
     % Currently we only allow the following characters.
     % XXX should we just use is_printable(Char) instead?
     %
-    % Note: the code here is similar to code in compiler/mercury_to_mercury.m
-    % and also runtime/mercury_trace_base.c; any changes here may require
-    % similar changes there.
-    %
-:- pred is_mercury_punctuation_char(char::in) is semidet.
+    % Note: the code here is similar to code in runtime/mercury_trace_base.c;
+    % any changes here may require similar changes there.
 
 is_mercury_punctuation_char(' ').
 is_mercury_punctuation_char('!').
Index: library/term_to_xml.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term_to_xml.m,v
retrieving revision 1.13
diff -u -b -r1.13 term_to_xml.m
--- library/term_to_xml.m	19 Apr 2006 05:17:59 -0000	1.13
+++ library/term_to_xml.m	19 Sep 2006 15:12:24 -0000
@@ -851,7 +851,7 @@
 mangle(Functor) = Element :-
     string.split(Functor, 1, Head, Tail),
     (
-        string.is_alpha(Head),
+        string.is_all_alpha(Head),
         string.to_lower(Head) = Head
     ->
         First = Head,
cvs diff: Diffing mdbcomp
Index: mdbcomp/program_representation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/program_representation.m,v
retrieving revision 1.16
diff -u -b -r1.16 program_representation.m
--- mdbcomp/program_representation.m	5 Sep 2006 06:21:37 -0000	1.16
+++ mdbcomp/program_representation.m	19 Sep 2006 15:14:49 -0000
@@ -443,7 +443,7 @@
     ).
 
 path_from_string(GoalPathStr, GoalPath) :-
-    StepStrs = string.words(is_path_separator, GoalPathStr),
+    StepStrs = string.words_separator(is_path_separator, GoalPathStr),
     list.map(path_step_from_string, StepStrs, GoalPath).
 
 path_step_from_string(String, Step) :-
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.11
diff -u -b -r1.11 trace_counts.m
--- mdbcomp/trace_counts.m	8 Jun 2006 08:19:53 -0000	1.11
+++ mdbcomp/trace_counts.m	19 Sep 2006 12:01:58 -0000
@@ -436,7 +436,7 @@
 
 read_proc_trace_counts(HeaderLineNumber, HeaderLine, CurFileName, !TraceCounts,
         !IO) :-
-    lexer.string_get_token_list(HeaderLine, string.length(HeaderLine),
+    lexer.string_get_token_list_max(HeaderLine, string.length(HeaderLine),
         TokenList, posn(HeaderLineNumber, 1, 0), _),
     (
         TokenList =
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
Index: tests/general/string_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/general/string_test.m,v
retrieving revision 1.6
diff -u -b -r1.6 string_test.m
--- tests/general/string_test.m	30 Mar 2005 10:52:05 -0000	1.6
+++ tests/general/string_test.m	20 Sep 2006 05:22:57 -0000
@@ -68,19 +68,20 @@
 		++ "                                                    eee",
 		10) },
 	{ WrappedHyphen = 
-		string.word_wrap("*aaaaaaaaaaaaaaaaaaaa*  bbbbb bbb  b\t"
+		string.word_wrap_separator(
+		"*aaaaaaaaaaaaaaaaaaaa*  bbbbb bbb  b\t"
 		++ " ccccc c c c   cccc c c c c ccccc ccc cccc c  ccc ccc ccc "
 		++ "*dddddddddddddddddddddddddddddddddddddddddddddddddddddd*"
 		++ "                                                    eee",
 		10, "-") },
 	{ WrappedDots = 
-		string.word_wrap("*aaaaaa*  bbbbb bbb  b\t"
+		string.word_wrap_separator("*aaaaaa*  bbbbb bbb  b\t"
 		++ " ccccc c c c   cccc c c c c ccccc ccc cccc c  ccc ccc ccc "
 		++ "*dddddddddddddd*"
 		++ "                                                    eee",
 		5, "...") },
 	{ SepTooLong = 
-		string.word_wrap("whatever", 2, "...") },
+		string.word_wrap_separator("whatever", 2, "...") },
 	write_string("\nWrapped string:\n"),
 	write_string(Wrapped),
 	write_string("\nWrapped string with hyphens:\n"),
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
Index: tests/hard_coded/string_strip.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/string_strip.exp,v
retrieving revision 1.2
diff -u -b -r1.2 string_strip.exp
--- tests/hard_coded/string_strip.exp	26 Oct 2003 12:43:33 -0000	1.2
+++ tests/hard_coded/string_strip.exp	20 Sep 2006 05:47:16 -0000
@@ -190,102 +190,102 @@
 strip("\ \ foo") = "foo"
 strip("foo\ \ ") = "foo"
 strip("\ \ foo\ \ ") = "foo"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\tfoo") = "\tfoo"
-lstrip(is_alpha)("foo\t") = "\t"
-lstrip(is_alpha)("\tfoo\t") = "\tfoo\t"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\nfoo") = "\nfoo"
-lstrip(is_alpha)("foo\n") = "\n"
-lstrip(is_alpha)("\nfoo\n") = "\nfoo\n"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\ foo") = "\ foo"
-lstrip(is_alpha)("foo\ ") = "\ "
-lstrip(is_alpha)("\ foo\ ") = "\ foo\ "
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\t\tfoo") = "\t\tfoo"
-lstrip(is_alpha)("foo\t\t") = "\t\t"
-lstrip(is_alpha)("\t\tfoo\t\t") = "\t\tfoo\t\t"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\t\nfoo") = "\t\nfoo"
-lstrip(is_alpha)("foo\t\n") = "\t\n"
-lstrip(is_alpha)("\t\nfoo\t\n") = "\t\nfoo\t\n"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\t\ foo") = "\t\ foo"
-lstrip(is_alpha)("foo\t\ ") = "\t\ "
-lstrip(is_alpha)("\t\ foo\t\ ") = "\t\ foo\t\ "
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\n\tfoo") = "\n\tfoo"
-lstrip(is_alpha)("foo\n\t") = "\n\t"
-lstrip(is_alpha)("\n\tfoo\n\t") = "\n\tfoo\n\t"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\n\nfoo") = "\n\nfoo"
-lstrip(is_alpha)("foo\n\n") = "\n\n"
-lstrip(is_alpha)("\n\nfoo\n\n") = "\n\nfoo\n\n"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\n\ foo") = "\n\ foo"
-lstrip(is_alpha)("foo\n\ ") = "\n\ "
-lstrip(is_alpha)("\n\ foo\n\ ") = "\n\ foo\n\ "
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\ \tfoo") = "\ \tfoo"
-lstrip(is_alpha)("foo\ \t") = "\ \t"
-lstrip(is_alpha)("\ \tfoo\ \t") = "\ \tfoo\ \t"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\ \nfoo") = "\ \nfoo"
-lstrip(is_alpha)("foo\ \n") = "\ \n"
-lstrip(is_alpha)("\ \nfoo\ \n") = "\ \nfoo\ \n"
-lstrip(is_alpha)("foo") = ""
-lstrip(is_alpha)("\ \ foo") = "\ \ foo"
-lstrip(is_alpha)("foo\ \ ") = "\ \ "
-lstrip(is_alpha)("\ \ foo\ \ ") = "\ \ foo\ \ "
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\tfoo") = "\t"
-rstrip(is_alpha)("foo\t") = "foo\t"
-rstrip(is_alpha)("\tfoo\t") = "\tfoo\t"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\nfoo") = "\n"
-rstrip(is_alpha)("foo\n") = "foo\n"
-rstrip(is_alpha)("\nfoo\n") = "\nfoo\n"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\ foo") = "\ "
-rstrip(is_alpha)("foo\ ") = "foo\ "
-rstrip(is_alpha)("\ foo\ ") = "\ foo\ "
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\t\tfoo") = "\t\t"
-rstrip(is_alpha)("foo\t\t") = "foo\t\t"
-rstrip(is_alpha)("\t\tfoo\t\t") = "\t\tfoo\t\t"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\t\nfoo") = "\t\n"
-rstrip(is_alpha)("foo\t\n") = "foo\t\n"
-rstrip(is_alpha)("\t\nfoo\t\n") = "\t\nfoo\t\n"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\t\ foo") = "\t\ "
-rstrip(is_alpha)("foo\t\ ") = "foo\t\ "
-rstrip(is_alpha)("\t\ foo\t\ ") = "\t\ foo\t\ "
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\n\tfoo") = "\n\t"
-rstrip(is_alpha)("foo\n\t") = "foo\n\t"
-rstrip(is_alpha)("\n\tfoo\n\t") = "\n\tfoo\n\t"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\n\nfoo") = "\n\n"
-rstrip(is_alpha)("foo\n\n") = "foo\n\n"
-rstrip(is_alpha)("\n\nfoo\n\n") = "\n\nfoo\n\n"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\n\ foo") = "\n\ "
-rstrip(is_alpha)("foo\n\ ") = "foo\n\ "
-rstrip(is_alpha)("\n\ foo\n\ ") = "\n\ foo\n\ "
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\ \tfoo") = "\ \t"
-rstrip(is_alpha)("foo\ \t") = "foo\ \t"
-rstrip(is_alpha)("\ \tfoo\ \t") = "\ \tfoo\ \t"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\ \nfoo") = "\ \n"
-rstrip(is_alpha)("foo\ \n") = "foo\ \n"
-rstrip(is_alpha)("\ \nfoo\ \n") = "\ \nfoo\ \n"
-rstrip(is_alpha)("foo") = ""
-rstrip(is_alpha)("\ \ foo") = "\ \ "
-rstrip(is_alpha)("foo\ \ ") = "foo\ \ "
-rstrip(is_alpha)("\ \ foo\ \ ") = "\ \ foo\ \ "
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\tfoo") = "\tfoo"
+lstrip_pred(is_alpha)("foo\t") = "\t"
+lstrip_pred(is_alpha)("\tfoo\t") = "\tfoo\t"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\nfoo") = "\nfoo"
+lstrip_pred(is_alpha)("foo\n") = "\n"
+lstrip_pred(is_alpha)("\nfoo\n") = "\nfoo\n"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\ foo") = "\ foo"
+lstrip_pred(is_alpha)("foo\ ") = "\ "
+lstrip_pred(is_alpha)("\ foo\ ") = "\ foo\ "
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\t\tfoo") = "\t\tfoo"
+lstrip_pred(is_alpha)("foo\t\t") = "\t\t"
+lstrip_pred(is_alpha)("\t\tfoo\t\t") = "\t\tfoo\t\t"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\t\nfoo") = "\t\nfoo"
+lstrip_pred(is_alpha)("foo\t\n") = "\t\n"
+lstrip_pred(is_alpha)("\t\nfoo\t\n") = "\t\nfoo\t\n"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\t\ foo") = "\t\ foo"
+lstrip_pred(is_alpha)("foo\t\ ") = "\t\ "
+lstrip_pred(is_alpha)("\t\ foo\t\ ") = "\t\ foo\t\ "
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\n\tfoo") = "\n\tfoo"
+lstrip_pred(is_alpha)("foo\n\t") = "\n\t"
+lstrip_pred(is_alpha)("\n\tfoo\n\t") = "\n\tfoo\n\t"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\n\nfoo") = "\n\nfoo"
+lstrip_pred(is_alpha)("foo\n\n") = "\n\n"
+lstrip_pred(is_alpha)("\n\nfoo\n\n") = "\n\nfoo\n\n"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\n\ foo") = "\n\ foo"
+lstrip_pred(is_alpha)("foo\n\ ") = "\n\ "
+lstrip_pred(is_alpha)("\n\ foo\n\ ") = "\n\ foo\n\ "
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\ \tfoo") = "\ \tfoo"
+lstrip_pred(is_alpha)("foo\ \t") = "\ \t"
+lstrip_pred(is_alpha)("\ \tfoo\ \t") = "\ \tfoo\ \t"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\ \nfoo") = "\ \nfoo"
+lstrip_pred(is_alpha)("foo\ \n") = "\ \n"
+lstrip_pred(is_alpha)("\ \nfoo\ \n") = "\ \nfoo\ \n"
+lstrip_pred(is_alpha)("foo") = ""
+lstrip_pred(is_alpha)("\ \ foo") = "\ \ foo"
+lstrip_pred(is_alpha)("foo\ \ ") = "\ \ "
+lstrip_pred(is_alpha)("\ \ foo\ \ ") = "\ \ foo\ \ "
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\tfoo") = "\t"
+rstrip_pred(is_alpha)("foo\t") = "foo\t"
+rstrip_pred(is_alpha)("\tfoo\t") = "\tfoo\t"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\nfoo") = "\n"
+rstrip_pred(is_alpha)("foo\n") = "foo\n"
+rstrip_pred(is_alpha)("\nfoo\n") = "\nfoo\n"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\ foo") = "\ "
+rstrip_pred(is_alpha)("foo\ ") = "foo\ "
+rstrip_pred(is_alpha)("\ foo\ ") = "\ foo\ "
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\t\tfoo") = "\t\t"
+rstrip_pred(is_alpha)("foo\t\t") = "foo\t\t"
+rstrip_pred(is_alpha)("\t\tfoo\t\t") = "\t\tfoo\t\t"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\t\nfoo") = "\t\n"
+rstrip_pred(is_alpha)("foo\t\n") = "foo\t\n"
+rstrip_pred(is_alpha)("\t\nfoo\t\n") = "\t\nfoo\t\n"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\t\ foo") = "\t\ "
+rstrip_pred(is_alpha)("foo\t\ ") = "foo\t\ "
+rstrip_pred(is_alpha)("\t\ foo\t\ ") = "\t\ foo\t\ "
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\n\tfoo") = "\n\t"
+rstrip_pred(is_alpha)("foo\n\t") = "foo\n\t"
+rstrip_pred(is_alpha)("\n\tfoo\n\t") = "\n\tfoo\n\t"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\n\nfoo") = "\n\n"
+rstrip_pred(is_alpha)("foo\n\n") = "foo\n\n"
+rstrip_pred(is_alpha)("\n\nfoo\n\n") = "\n\nfoo\n\n"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\n\ foo") = "\n\ "
+rstrip_pred(is_alpha)("foo\n\ ") = "foo\n\ "
+rstrip_pred(is_alpha)("\n\ foo\n\ ") = "\n\ foo\n\ "
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\ \tfoo") = "\ \t"
+rstrip_pred(is_alpha)("foo\ \t") = "foo\ \t"
+rstrip_pred(is_alpha)("\ \tfoo\ \t") = "\ \tfoo\ \t"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\ \nfoo") = "\ \n"
+rstrip_pred(is_alpha)("foo\ \n") = "foo\ \n"
+rstrip_pred(is_alpha)("\ \nfoo\ \n") = "\ \nfoo\ \n"
+rstrip_pred(is_alpha)("foo") = ""
+rstrip_pred(is_alpha)("\ \ foo") = "\ \ "
+rstrip_pred(is_alpha)("foo\ \ ") = "foo\ \ "
+rstrip_pred(is_alpha)("\ \ foo\ \ ") = "\ \ foo\ \ "
 prefix_length(is_whitespace)("foo") = "0"
 prefix_length(is_whitespace)("\tfoo") = "1"
 prefix_length(is_whitespace)("foo\t") = "0"
Index: tests/hard_coded/string_strip.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/string_strip.m,v
retrieving revision 1.3
diff -u -b -r1.3 string_strip.m
--- tests/hard_coded/string_strip.m	29 Mar 2006 08:08:02 -0000	1.3
+++ tests/hard_coded/string_strip.m	20 Sep 2006 05:23:48 -0000
@@ -65,11 +65,11 @@
         "strip" -
         strip,
 
-        "lstrip(is_alpha)" -
-        lstrip(char.is_alpha),
+        "lstrip_pred(is_alpha)" -
+        lstrip_pred(char.is_alpha),
 
-        "rstrip(is_alpha)" -
-        rstrip(char.is_alpha),
+        "rstrip_pred(is_alpha)" -
+        rstrip_pred(char.is_alpha),
 
         "prefix_length(is_whitespace)" -
         ( func(S) = format("%d", [i(prefix_length(char.is_whitespace, S))]) ),
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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