[m-rev.] for review: preparing promise_equivalent_solutions extension

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Feb 24 16:45:46 AEDT 2006


The idea has already been reviewed, and the implementation is straightforward,
so this is for post-commit review by anyone.

Zoltan.

Prepare for an extension of promise_equivalent_solutions that will allow us
to better handle values of user-defined types. The problem is that currently,
the deconstruction of a value of such a type can be followed only by code that
cannot fail, otherwise the cc_multi deconstruction is not in the required
single-solution context. If the following code is naturally semidet, this
can be worked around by turning it into det code returning a maybe and testing
the maybe outside the promise_equivalent_solutions, but this is inefficient,
and in any case it does not generalize to nondet code without even more
horrendous inefficiency and inconvenience. (You have to create a nondet closure
and call it outside the promise_equivalent_solutions.)

The solution I came up with is something is to have a construct that contains

	- a list of deconstructions on types with user-defined equality,
	- a goal, and
	- the list of outputs of that goal.

The idea is that this would be transformed into a conjunction of the first and
second items, and wrapped inside a special kind of conj that provides a scope
for the implicit promise, which is that the set of solutions of the goal in
the second item doesn't depend on what concrete terms the deconstructions
in the first item return out of the set of concrete terms they *could* return.
The deconstructions in the first item would be marked to tell determinism
analysis to effectively ignore the fact that they involve user-defined
equality.

The actual addition of that construct is left for a future change, after we
agree on the syntax.

compiler/hlds_goal.m:
	Generalize the existing promise_equivalent_solutions scope to a
	promise_solutions scope with a flag that says whether in the source
	code it was originally the existing "promise_equivalent_solutions"
	construct or the new construct (which doesn't exist yet, but is
	indicated by the symbol "same_solutions" for now).

	Replace the conj and par_conj hlds_goal_exprs with a single goal
	expression: conj with an additional argument which is either plain_conj
	or parallel_conj. This was part of an earlier design in which a third
	kind of disjunction took the role now assigned to the new kind of
	promise_solutions scope, but turned out to be a good idea anyway,
	since in many places the compiler does treat the two kinds of
	conjunctions the same. This part of the change is responsible for the
	fact that this change results in a net *reduction* of about 40 lines.

	Move the most frequently used kinds of goal expressions to the front
	of the type declaration to allow the compiler to make better decisions
	about tag allocation.

	Add the goal marker we will add to the deconstructions in the first
	item.

	Replace the true_goal and fail_goal predicates with functions to make
	them easier to use, and rename their variants that take a context
	argument to avoid unnecessary ambiguity.

compiler/*.m:
	Conform to the change in hlds_goal.m.

	Misc changes to make code more robust, e.g. replacing semidet
	predicates on goal expressions with functions returning bool.

	Misc cleanups, e.g. removal of unnecessary module qualifications
	that made lines too long, renaming predicates whose names include
	"disj" if they are also used to process parallel conjunctions (since in
	both parallel conjunctions and in disjunctions the goals are
	independent), and turning semidet predicates that switch on goal
	expressions into bool functions (to make similar changes more rebust
	in the future).

cvs diff: Diffing .
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/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.50
diff -u -b -r1.50 accumulator.m
--- compiler/accumulator.m	23 Feb 2006 09:36:46 -0000	1.50
+++ compiler/accumulator.m	24 Feb 2006 01:44:15 -0000
@@ -419,7 +419,7 @@
 standardize(Goal0, Goal) :-
     (
         (
-            Goal0 = conj([Goal1]) - _
+            Goal0 = conj(plain_conj, [Goal1]) - _
         ;
             Goal0 = disj([Goal1]) - _
         )
@@ -1104,7 +1104,7 @@
         ModuleInfo, !Substs, !VarSet, !VarTypes, UpdateOut, UpdateAccOut,
         BasePairs),
 
-    Accs = set__to_sorted_list(InitAccs) `append` UpdateAccOut,
+    Accs = set__to_sorted_list(InitAccs) ++ UpdateAccOut,
 
     divide_base_case(UpdateOut, Out, GoalStore, !.VarTypes, ModuleInfo,
         UpdateBase, AssocBase, OtherBase),
@@ -1456,7 +1456,7 @@
     % We place the extra accumulator variables at the start, because placing
     % them at the end breaks the convention that the last variable of a
     % function is the output variable.
-    HeadVars = Accs `append` HeadVars0,
+    HeadVars = Accs ++ HeadVars0,
 
     % XXX we don't want to use the inst of the var as it can be more specific
     % than it should be. ie int_const(1) when it should be any integer.
@@ -1465,7 +1465,7 @@
     Inst = ground(shared, none),
     inst_lists_to_mode_list([Inst], [Inst], Mode),
     list__duplicate(list__length(Accs), list__det_head(Mode), AccModes),
-    HeadModes = AccModes `append` HeadModes0,
+    HeadModes = AccModes ++ HeadModes0,
 
     list__map(map__lookup(VarTypes), Accs, AccTypes),
 
@@ -1498,7 +1498,7 @@
     term__context_line(Context, Line),
     Counter = 0,
 
-    Types = NewTypes `append` Types0,
+    Types = NewTypes ++ Types0,
 
     make_pred_name_with_context(ModuleName, "AccFrom", PredOrFunc, Name,
         Line, Counter, SymName),
@@ -1541,7 +1541,7 @@
 
 create_acc_call(OrigCall, Accs, AccPredId, AccProcId, AccName) = Call :-
     OrigCall = call(_PredId, _ProcId, Args, Builtin, Context, _Name) - GI,
-    Call = call(AccPredId, AccProcId, Accs `append` Args,
+    Call = call(AccPredId, AccProcId, Accs ++ Args,
         Builtin, Context, AccName) - GI.
 
     % Create the goals which are to replace the original predicate.
@@ -1562,12 +1562,12 @@
 
     goal_util__rename_vars_in_goal(CallToHeadSubst, Call, BaseCall),
     Cbefore = goal_list(set__to_sorted_list(Before), C),
-    Uupdate = goal_list(set__to_sorted_list(UpdateBase) `append`
+    Uupdate = goal_list(set__to_sorted_list(UpdateBase) ++
         set__to_sorted_list(Update), U),
     Cbase = goal_list(base_case_ids(C), C),
-    calculate_goal_info(conj(Cbefore `append` Uupdate `append` [BaseCall]),
+    calculate_goal_info(conj(plain_conj, Cbefore ++ Uupdate ++ [BaseCall]),
         OrigRecGoal),
-    calculate_goal_info(conj(Cbase), OrigBaseGoal).
+    calculate_goal_info(conj(plain_conj, Cbase), OrigBaseGoal).
 
     % Create the goals which are to go in the new accumulator
     % version of the predicate.
@@ -1576,8 +1576,8 @@
     list(pair(prog_var))::in, sets::in, goal_store::in,
     goal_store::in, hlds_goal::out, hlds_goal::out) is det.
 
-create_acc_goal(Call, Substs, HeadToCallSubst,
-        BaseIds, BasePairs, Sets, C, CS, AccBaseGoal, AccRecGoal) :-
+create_acc_goal(Call, Substs, HeadToCallSubst, BaseIds, BasePairs, Sets,
+        C, CS, AccBaseGoal, AccRecGoal) :-
     Substs = substs(AccVarSubst, RecCallSubst, AssocCallSubst, UpdateSubst),
 
     BaseIds = base(_UpdateBase, AssocBase, OtherBase),
@@ -1603,13 +1603,13 @@
         Construct `union` ConstructAssoc),
 
     BaseCase = goal_list(set__to_sorted_list(AssocBase `union` OtherBase)
-        `append` Bafter, B),
+        ++ Bafter, B),
 
     list__map(acc_unification, BasePairs, UpdateBase),
 
-    calculate_goal_info(conj(Cbefore `append` Rassoc `append`
-        Rupdate `append` [RecCall] `append` Rconstruct), AccRecGoal),
-    calculate_goal_info(conj(UpdateBase `append` BaseCase), AccBaseGoal).
+    calculate_goal_info(conj(plain_conj, Cbefore ++ Rassoc ++ Rupdate
+        ++ [RecCall] ++ Rconstruct), AccRecGoal),
+    calculate_goal_info(conj(plain_conj, UpdateBase ++ BaseCase), AccBaseGoal).
 
     % Create the U set of goals (those that will be used in the
     % original recursive case) by renaming all the goals which are
@@ -1829,9 +1829,7 @@
 :- pred calculate_goal_info(hlds_goal_expr::in, hlds_goal::out) is det.
 
 calculate_goal_info(GoalExpr, GoalExpr - GoalInfo) :-
-    (
-        GoalExpr = conj(GoalList)
-    ->
+    ( GoalExpr = conj(plain_conj, GoalList) ->
         goal_list_nonlocals(GoalList, NonLocals),
         goal_list_instmap_delta(GoalList, InstMapDelta),
         goal_list_determinism(GoalList, Determinism),
Index: compiler/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.14
diff -u -b -r1.14 add_clause.m
--- compiler/add_clause.m	23 Feb 2006 09:36:47 -0000	1.14
+++ compiler/add_clause.m	24 Feb 2006 02:28:16 -0000
@@ -438,12 +438,11 @@
     qual_info_set_found_syntax_error(no, !QualInfo),
     (
         FoundError = yes,
-            % Don't insert clauses containing syntax errors into
-            % the clauses_info, because doing that would cause
-            % typecheck.m to report spurious type errors.
-            % Don't report singleton variable warnings if there
-            % were syntax errors.
-        true_goal(Goal)
+        % Don't insert clauses containing syntax errors into the clauses_info,
+        % because doing that would cause typecheck.m to report spurious type
+        % errors. Don't report singleton variable warnings if there were
+        % syntax errors.
+        Goal = true_goal
     ;
         FoundError = no,
         Goal = Goal0,
@@ -492,7 +491,7 @@
         prepare_for_head(!:SInfo),
         term__apply_substitution_to_list(Args0, Subst, Args1),
         substitute_state_var_mappings(Args1, Args, !VarSet, !SInfo, !IO),
-        hlds_goal__true_goal(HeadGoal0),
+        HeadGoal0 = true_goal,
         ( GoalType = promise(_) ->
             HeadGoal = HeadGoal0
         ;
@@ -531,8 +530,8 @@
         !QualInfo, !SInfo, !IO) :-
     goal_info_init(GoalInfo),
     prepare_for_next_conjunct(set__init, !VarSet, !SInfo).
-transform_goal_2(true, _, _, conj([]) - GoalInfo, !VarSet, !ModuleInfo,
-        !QualInfo, !SInfo, !IO) :-
+transform_goal_2(true, _, _, conj(plain_conj, []) - GoalInfo, !VarSet,
+        !ModuleInfo, !QualInfo, !SInfo, !IO) :-
     goal_info_init(GoalInfo),
     prepare_for_next_conjunct(set__init, !VarSet, !SInfo).
 transform_goal_2(all(Vars0, Goal0), Context, Subst, Goal, !VarSet, !ModuleInfo,
@@ -572,7 +571,7 @@
 transform_goal_2(
         promise_equivalent_solutions(Vars0, DotSVars0, ColonSVars0, Goal0),
         Context, Subst,
-        scope(promise_equivalent_solutions(Vars), Goal) - GoalInfo,
+        scope(promise_solutions(Vars, equivalent_solutions), Goal) - GoalInfo,
         !VarSet, !ModuleInfo, !QualInfo, !SInfo, !IO) :-
     substitute_vars(Vars0, Subst, Vars1),
     substitute_vars(DotSVars0, Subst, DotSVars1),
@@ -734,10 +733,10 @@
     % unification to be !X (it may be !.X or !:X, however).
     ( A0 = functor(atom("!"), [variable(StateVarA)], _) ->
         report_svar_unify_error(Context, !.VarSet, StateVarA, !IO),
-        true_goal(Goal)
+        Goal = true_goal
     ; B0 = functor(atom("!"), [variable(StateVarB)], _) ->
         report_svar_unify_error(Context, !.VarSet, StateVarB, !IO),
-        true_goal(Goal)
+        Goal = true_goal
     ;
         prepare_for_call(!SInfo),
         term__apply_substitution(A0, Subst, A),
Index: compiler/add_heap_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_heap_ops.m,v
retrieving revision 1.22
diff -u -b -r1.22 add_heap_ops.m
--- compiler/add_heap_ops.m	28 Nov 2005 04:11:37 -0000	1.22
+++ compiler/add_heap_ops.m	18 Feb 2006 05:01:18 -0000
@@ -107,10 +107,8 @@
 :- pred goal_expr_add_heap_ops(hlds_goal_expr::in, hlds_goal_info::in,
     hlds_goal::out, heap_ops_info::in, heap_ops_info::out) is det.
 
-goal_expr_add_heap_ops(conj(Goals0), GI, conj(Goals) - GI, !Info) :-
-    conj_add_heap_ops(Goals0, Goals, !Info).
-
-goal_expr_add_heap_ops(par_conj(Goals0), GI, par_conj(Goals) - GI, !Info) :-
+goal_expr_add_heap_ops(conj(ConjType, Goals0), GI, conj(ConjType, Goals) - GI,
+        !Info) :-
     conj_add_heap_ops(Goals0, Goals, !Info).
 
 goal_expr_add_heap_ops(disj([]), GI, disj([]) - GI, !Info).
@@ -134,7 +132,7 @@
         gen_mark_hp(SavedHeapPointerVar, Context, MarkHeapPointerGoal, !Info),
         disj_add_heap_ops(Goals0, yes, yes(SavedHeapPointerVar), GoalInfo,
             Goals, !Info),
-        Goal = conj([MarkHeapPointerGoal, disj(Goals) - GoalInfo])
+        Goal = conj(plain_conj, [MarkHeapPointerGoal, disj(Goals) - GoalInfo])
     ;
         disj_add_heap_ops(Goals0, yes, no, GoalInfo, Goals, !Info),
         Goal = disj(Goals)
@@ -153,8 +151,8 @@
     InnerGoal = _ - InnerGoalInfo,
     goal_info_get_determinism(InnerGoalInfo, Determinism),
     determinism_components(Determinism, _CanFail, NumSolns),
-    true_goal(Context, True),
-    fail_goal(Context, Fail),
+    True = true_goal_with_context(Context),
+    Fail = fail_goal_with_context(Context),
     ModuleInfo = !.Info ^ module_info,
     ( NumSolns = at_most_zero ->
         % The "then" part of the if-then-else will be unreachable, but to
@@ -191,9 +189,10 @@
         gen_restore_hp(SavedHeapPointerVar, Context, RestoreHeapPointerGoal,
             !Info),
         Else1 = _ - Else1GoalInfo,
-        Else = conj([RestoreHeapPointerGoal, Else1]) - Else1GoalInfo,
+        Else = conj(plain_conj, [RestoreHeapPointerGoal, Else1])
+            - Else1GoalInfo,
         IfThenElse = if_then_else(A, Cond, Then, Else) - GoalInfo,
-        Goal = conj([MarkHeapPointerGoal, IfThenElse])
+        Goal = conj(plain_conj, [MarkHeapPointerGoal, IfThenElse])
     ;
         Goal = if_then_else(A, Cond, Then, Else1)
     ).
@@ -271,7 +270,8 @@
         % disjunction, so that the heap pointer variable can scope over
         % these disjuncts.
         Disj = disj([Goal | Goals1]) - DisjGoalInfo,
-        DisjGoals = [conj([MarkHeapPointerGoal, Disj]) - DisjGoalInfo]
+        DisjGoals = [conj(plain_conj, [MarkHeapPointerGoal, Disj])
+            - DisjGoalInfo]
     ;
         % Just recursively handle the remaining disjuncts.
         disj_add_heap_ops(Goals0, no, MaybeSavedHeapPointerVar, DisjGoalInfo,
Index: compiler/add_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
retrieving revision 1.11
diff -u -b -r1.11 add_pred.m
--- compiler/add_pred.m	23 Feb 2006 09:36:48 -0000	1.11
+++ compiler/add_pred.m	24 Feb 2006 01:44:16 -0000
@@ -234,7 +234,7 @@
         Module = mercury_private_builtin_module,
         Name = "store_at_ref"
     ->
-        GoalExpr = conj([])
+        GoalExpr = conj(plain_conj, [])
     ;
         GoalExpr = call(PredId, ModeId, HeadVars, inline_builtin,
             MaybeUnifyContext, SymName)
Index: compiler/add_trail_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_trail_ops.m,v
retrieving revision 1.30
diff -u -b -r1.30 add_trail_ops.m
--- compiler/add_trail_ops.m	24 Feb 2006 01:41:44 -0000	1.30
+++ compiler/add_trail_ops.m	24 Feb 2006 01:44:17 -0000
@@ -149,14 +149,11 @@
 :- pred goal_expr_add_trail_ops(hlds_goal_expr::in, hlds_goal_info::in,
     hlds_goal::out, trail_ops_info::in, trail_ops_info::out) is det.
 
-goal_expr_add_trail_ops(conj(Goals0), GI, conj(Goals) - GI, !Info) :-
-    conj_add_trail_ops(Goals0, Goals, !Info).
-
-goal_expr_add_trail_ops(par_conj(Goals0), GI, par_conj(Goals) - GI, !Info) :-
+goal_expr_add_trail_ops(conj(ConjType, Goals0), GI, conj(ConjType, Goals) - GI,
+        !Info) :-
     conj_add_trail_ops(Goals0, Goals, !Info).
 
 goal_expr_add_trail_ops(disj([]), GI, disj([]) - GI, !Info).
-
 goal_expr_add_trail_ops(disj(Goals0), GoalInfo, Goal - GoalInfo, !Info) :-
     Goals0 = [_ | _],
 
@@ -168,7 +165,7 @@
     new_ticket_var(TicketVar, !Info),
     gen_store_ticket(TicketVar, Context, StoreTicketGoal, !.Info),
     disj_add_trail_ops(Goals0, yes, no, CodeModel, TicketVar, Goals, !Info),
-    Goal = conj([StoreTicketGoal, disj(Goals) - GoalInfo]).
+    Goal = conj(plain_conj, [StoreTicketGoal, disj(Goals) - GoalInfo]).
 
 goal_expr_add_trail_ops(switch(A, B, Cases0), GI, switch(A, B, Cases) - GI,
         !Info) :-
@@ -183,8 +180,8 @@
     InnerGoal = _ - InnerGoalInfo,
     goal_info_get_determinism(InnerGoalInfo, Determinism),
     determinism_components(Determinism, _CanFail, NumSolns),
-    true_goal(Context, True),
-    fail_goal(Context, Fail),
+    True = true_goal_with_context(Context),
+    Fail = fail_goal_with_context(Context),
     ModuleInfo = !.Info ^ module_info,
     ( NumSolns = at_most_zero ->
         % The "then" part of the if-then-else will be unreachable, but to
@@ -236,21 +233,23 @@
         % discard this trail ticket before backtracking over it.
         gen_reset_ticket_undo(TicketVar, Context, ResetTicketUndoGoal, !.Info),
         gen_discard_ticket(Context, DiscardTicketGoal, !.Info),
-        fail_goal(Context, FailGoal),
+        FailGoal = fail_goal_with_context(Context),
 
         % Put it all together.
         Goal2 = scope(Reason, Goal1) - OuterGoalInfo,
-        SuccCode = conj([Goal2, ResetTicketCommitGoal, PruneTicketsToGoal])
+        SuccCode = conj(plain_conj,
+            [Goal2, ResetTicketCommitGoal, PruneTicketsToGoal])
             - OuterGoalInfo,
         ( OuterCodeModel = model_semi ->
             FailGoal = _ - FailGoalInfo,
-            FailCode = conj([ResetTicketUndoGoal, DiscardTicketGoal, FailGoal])
+            FailCode = conj(plain_conj,
+                [ResetTicketUndoGoal, DiscardTicketGoal, FailGoal])
                 - FailGoalInfo,
             Goal3 = disj([SuccCode, FailCode]) - OuterGoalInfo
         ;
             Goal3 = SuccCode
         ),
-        Goal = conj([MarkTicketStackGoal, StoreTicketGoal, Goal3])
+        Goal = conj(plain_conj, [MarkTicketStackGoal, StoreTicketGoal, Goal3])
     ;
         goal_add_trail_ops(Goal0, Goal1, !Info),
         Goal = scope(Reason, Goal1)
@@ -275,21 +274,22 @@
     ( CondCodeModel = model_non ->
         gen_reset_ticket_solve(TicketVar, Context, ResetTicketSolveGoal,
             !.Info),
-        Then = conj([ResetTicketSolveGoal, Then1]) - Then1GoalInfo
+        Then = conj(plain_conj, [ResetTicketSolveGoal, Then1]) - Then1GoalInfo
     ;
         gen_reset_ticket_commit(TicketVar, Context, ResetTicketCommitGoal,
             !.Info),
         gen_prune_ticket(Context, PruneTicketGoal, !.Info),
-        Then = conj([ResetTicketCommitGoal, PruneTicketGoal, Then1])
+        Then = conj(plain_conj,
+            [ResetTicketCommitGoal, PruneTicketGoal, Then1])
             - Then1GoalInfo
     ),
     gen_reset_ticket_undo(TicketVar, Context, ResetTicketUndoGoal, !.Info),
     gen_discard_ticket(Context, DiscardTicketGoal, !.Info),
     Else1 = _ - Else1GoalInfo,
-    Else = conj([ResetTicketUndoGoal, DiscardTicketGoal, Else1])
+    Else = conj(plain_conj, [ResetTicketUndoGoal, DiscardTicketGoal, Else1])
         - Else1GoalInfo,
     IfThenElse = if_then_else(A, Cond, Then, Else) - GoalInfo,
-    Goal = conj([StoreTicketGoal, IfThenElse]).
+    Goal = conj(plain_conj, [StoreTicketGoal, IfThenElse]).
 
 goal_expr_add_trail_ops(Goal @ call(_, _, _, _, _, _), GI, Goal - GI, !Info).
 
Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.44
diff -u -b -r1.44 assertion.m
--- compiler/assertion.m	23 Feb 2006 09:36:48 -0000	1.44
+++ compiler/assertion.m	24 Feb 2006 02:25:17 -0000
@@ -15,7 +15,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module hlds__assertion.
+:- module hlds.assertion.
 :- interface.
 
 :- import_module hlds.hlds_data.
@@ -29,15 +29,15 @@
 
     % Get the hlds_goal which represents the assertion.
     %
-:- pred assertion__goal(assert_id::in, module_info::in, hlds_goal::out) is det.
+:- pred goal(assert_id::in, module_info::in, hlds_goal::out) is det.
 
     % Record into the pred_info of each pred used in the assertion
     % the assert_id.
     %
-:- pred assertion__record_preds_used_in(hlds_goal::in, assert_id::in,
+:- pred record_preds_used_in(hlds_goal::in, assert_id::in,
     module_info::in, module_info::out) is det.
 
-    % assertion__is_commutativity_assertion(Id, MI, Vs, CVs):
+    % is_commutativity_assertion(Id, MI, Vs, CVs):
     %
     % Does the assertion represented by the assertion id, Id,
     % state the commutativity of a pred/func?
@@ -53,10 +53,10 @@
     % arguments, Is, can be any where providing they are in
     % identical locations on both sides of the equivalence).
     %
-:- pred assertion__is_commutativity_assertion(assert_id::in, module_info::in,
+:- pred is_commutativity_assertion(assert_id::in, module_info::in,
     prog_vars::in, pair(prog_var)::out) is semidet.
 
-    % assertion__is_associativity_assertion(Id, MI, Vs, CVs, OV):
+    % is_associativity_assertion(Id, MI, Vs, CVs, OV):
     %
     % Does the assertion represented by the assertion id, Id,
     % state the associativity of a pred/func?
@@ -80,10 +80,10 @@
     % arguments, Is, can be any where providing they are in
     % identical locations on both sides of the equivalence).
     %
-:- pred assertion__is_associativity_assertion(assert_id::in, module_info::in,
+:- pred is_associativity_assertion(assert_id::in, module_info::in,
     prog_vars::in, pair(prog_var)::out, prog_var::out) is semidet.
 
-    % assertion__is_associativity_assertion(Id, MI, PId, Vs, SPair):
+    % is_associativity_assertion(Id, MI, PId, Vs, SPair):
     %
     % Recognise assertions in the form
     %   all [A,B,S0,S]
@@ -95,10 +95,10 @@
     % and given the actual variables, Vs, to the call to p, return
     % the pair of variables which are state variables, SPair.
     %
-:- pred assertion__is_update_assertion(assert_id::in, module_info::in,
+:- pred is_update_assertion(assert_id::in, module_info::in,
     pred_id::in, prog_vars::in, pair(prog_var)::out) is semidet.
 
-    % assertion__is_construction_equivalence_assertion(Id, MI, C, P):
+    % is_construction_equivalence_assertion(Id, MI, C, P):
     %
     % Can a single construction unification whose functor is
     % determined by the cons_id, C, be expressed as a call
@@ -108,20 +108,20 @@
     % The assertion will be in a form similar to
     %   all [L,H,T] ( L = [H|T] <=> append([H], T, L) )
     %
-:- pred assertion__is_construction_equivalence_assertion(assert_id::in,
+:- pred is_construction_equivalence_assertion(assert_id::in,
     module_info::in, cons_id::in, pred_id::in) is semidet.
 
     % Ensure that an assertion which is defined in an interface
     % doesn't refer to any constructors, functions and predicates
     % defined in the implementation of that module.
     %
-:- pred assertion__in_interface_check(hlds_goal::in, pred_info::in,
+:- pred in_interface_check(hlds_goal::in, pred_info::in,
     module_info::in, module_info::out, io::di, io::uo) is det.
 
     % Place a hlds_goal into a standard form.  Currently all the
     % code does is replace conj([G]) with G.
     %
-:- pred assertion__normalise_goal(hlds_goal::in, hlds_goal::out) is det.
+:- pred normalise_goal(hlds_goal::in, hlds_goal::out) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -152,9 +152,9 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__is_commutativity_assertion(AssertId, Module, CallVars,
+is_commutativity_assertion(AssertId, Module, CallVars,
         CommutativeVars) :-
-    assertion__goal(AssertId, Module, Goal),
+    goal(AssertId, Module, Goal),
     equivalent(Goal, P, Q),
     P = call(PredId, _, VarsP, _, _, _) - _,
     Q = call(PredId, _, VarsQ, _, _, _) - _,
@@ -196,9 +196,9 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__is_associativity_assertion(AssertId, Module, CallVars,
+is_associativity_assertion(AssertId, Module, CallVars,
         AssociativeVars, OutputVar) :-
-    assertion__goal(AssertId, Module, Goal - GoalInfo),
+    goal(AssertId, Module, Goal - GoalInfo),
     equivalent(Goal - GoalInfo, P, Q),
 
     goal_info_get_nonlocals(GoalInfo, UniversiallyQuantifiedVars),
@@ -206,14 +206,14 @@
         % There may or may not be a some [] depending on whether
         % the user explicity qualified the call or not.
     (
-        P = scope(_, conj(PCalls0) - _) - _PGoalInfo,
-        Q = scope(_, conj(QCalls0) - _) - _QGoalInfo
+        P = scope(_, conj(plain_conj, PCalls0) - _) - _PGoalInfo,
+        Q = scope(_, conj(plain_conj, QCalls0) - _) - _QGoalInfo
     ->
         PCalls = PCalls0,
         QCalls = QCalls0
     ;
-        P = conj(PCalls) - _PGoalInfo,
-        Q = conj(QCalls) - _QGoalInfo
+        P = conj(plain_conj, PCalls) - _PGoalInfo,
+        Q = conj(plain_conj, QCalls) - _QGoalInfo
     ),
     promise_equivalent_solutions [AssociativeVars, OutputVar] (
          associative(PCalls, QCalls, UniversiallyQuantifiedVars, CallVars,
@@ -245,18 +245,18 @@
     % If you read the predicate documentation, you will note that
     % for each pair of variables on the left hand side there are an equivalent
     % pair of variables on the right hand side. As the pairs of variables
-    % are not symmetric, the call to list__perm will only succeed once,
+    % are not symmetric, the call to list.perm will only succeed once,
     % if at all.
-    assoc_list__from_corresponding_lists(PairsL, PairsR, Pairs),
-    list__perm(Pairs, [(A - AB) - (B - A), (B - C) - (C - BC),
+    assoc_list.from_corresponding_lists(PairsL, PairsR, Pairs),
+    list.perm(Pairs, [(A - AB) - (B - A), (B - C) - (C - BC),
         (AB - ABC) - (BC - ABC)]),
 
-    assoc_list__from_corresponding_lists(Vs, CallVars, AssocList),
-    list__filter((pred(X-_Y::in) is semidet :- X = AB),
+    assoc_list.from_corresponding_lists(Vs, CallVars, AssocList),
+    list.filter((pred(X-_Y::in) is semidet :- X = AB),
         AssocList, [_AB - OutputVar]),
-    list__filter((pred(X-_Y::in) is semidet :- X = A),
+    list.filter((pred(X-_Y::in) is semidet :- X = A),
         AssocList, [_A - CallVarA]),
-    list__filter((pred(X-_Y::in) is semidet :- X = B),
+    list.filter((pred(X-_Y::in) is semidet :- X = B),
         AssocList, [_B - CallVarB]).
 
     % reorder(Ps, Qs, Ls, Rs):
@@ -267,11 +267,11 @@
     hlds_goals::out, hlds_goals::out) is multi.
 
 reorder(PCalls, QCalls, LHSCalls, RHSCalls) :-
-    list__perm(PCalls, LHSCalls),
-    list__perm(QCalls, RHSCalls).
+    list.perm(PCalls, LHSCalls),
+    list.perm(QCalls, RHSCalls).
 reorder(PCalls, QCalls, LHSCalls, RHSCalls) :-
-    list__perm(PCalls, RHSCalls),
-    list__perm(QCalls, LHSCalls).
+    list.perm(PCalls, RHSCalls),
+    list.perm(QCalls, LHSCalls).
 
     % process_one_side(Gs, Us, L, Ps):
     %
@@ -294,8 +294,8 @@
 
     % Filter out all the invariant arguments, and then make sure that
     % their is only 3 arguments left.
-    list__filter((pred(X-Y::in) is semidet :- not X = Y), Vars0, Vars),
-    list__length(Vars, number_of_associative_vars).
+    list.filter((pred(X-Y::in) is semidet :- not X = Y), Vars0, Vars),
+    list.length(Vars, number_of_associative_vars).
 
 :- func number_of_associative_vars = int.
 
@@ -304,7 +304,7 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-    % assertion__is_update_assertion(Id, MI, PId, Ss):
+    % is_update_assertion(Id, MI, PId, Ss):
     %
     % is true iff the assertion, Id, is about a predicate, PId,
     % which takes some state as input and produces some state as
@@ -320,23 +320,23 @@
     %       (some [SB] (update(S0,B,SB), update(SB,A,S)))
     %   ).
     %
-assertion__is_update_assertion(AssertId, Module, _PredId, CallVars,
+is_update_assertion(AssertId, Module, _PredId, CallVars,
         StateA - StateB) :-
-    assertion__goal(AssertId, Module, Goal - GoalInfo),
+    goal(AssertId, Module, Goal - GoalInfo),
     equivalent(Goal - GoalInfo, P, Q),
     goal_info_get_nonlocals(GoalInfo, UniversiallyQuantifiedVars),
 
         % There may or may not be an explicit some [Vars] there,
         % as quantification now works correctly.
     (
-        P = scope(_, conj(PCalls0) - _) - _PGoalInfo,
-        Q = scope(_, conj(QCalls0) - _) - _QGoalInfo
+        P = scope(_, conj(plain_conj, PCalls0) - _) - _PGoalInfo,
+        Q = scope(_, conj(plain_conj, QCalls0) - _) - _QGoalInfo
     ->
         PCalls = PCalls0,
         QCalls = QCalls0
     ;
-        P = conj(PCalls) - _PGoalInfo,
-        Q = conj(QCalls) - _QGoalInfo
+        P = conj(plain_conj, PCalls) - _PGoalInfo,
+        Q = conj(plain_conj, QCalls) - _QGoalInfo
     ),
 
     solutions(update(PCalls, QCalls, UniversiallyQuantifiedVars, CallVars),
@@ -356,21 +356,21 @@
     process_two_linked_calls(RHSCalls, UniversiallyQuantifiedVars, PredId,
         SB, PairsR, _),
 
-    assoc_list__from_corresponding_lists(PairsL, PairsR, Pairs0),
-    list__filter((pred(X-Y::in) is semidet :- X \= Y), Pairs0, Pairs),
-    list__length(Pairs) = 2,
+    assoc_list.from_corresponding_lists(PairsL, PairsR, Pairs0),
+    list.filter((pred(X-Y::in) is semidet :- X \= Y), Pairs0, Pairs),
+    list.length(Pairs) = 2,
 
     % If you read the predicate documentation, you will note that
     % for each pair of variables on the left hand side there is an equivalent
     % pair of variables on the right hand side. As the pairs of variables
-    % are not symmetric, the call to list__perm will only succeed once,
+    % are not symmetric, the call to list.perm will only succeed once,
     % if at all.
-    list__perm(Pairs, [(S0 - SA) - (SB - S0), (SA - S) - (S - SB)]),
+    list.perm(Pairs, [(S0 - SA) - (SB - S0), (SA - S) - (S - SB)]),
 
-    assoc_list__from_corresponding_lists(Vs, CallVars, AssocList),
-    list__filter((pred(X-_Y::in) is semidet :- X = S0),
+    assoc_list.from_corresponding_lists(Vs, CallVars, AssocList),
+    list.filter((pred(X-_Y::in) is semidet :- X = S0),
         AssocList, [_S0 - StateA]),
-    list__filter((pred(X-_Y::in) is semidet :- X = SA),
+    list.filter((pred(X-_Y::in) is semidet :- X = SA),
         AssocList, [_SA - StateB]).
 
 %-----------------------------------------------------------------------------%
@@ -397,18 +397,17 @@
         % By definition it must be existentially quantified and
         % a member of both variable lists.
     CommonVars = list_to_set(VarsA) `intersect` list_to_set(VarsB),
-    set__singleton_set(CommonVars `difference` UniversiallyQuantifiedVars,
+    set.singleton_set(CommonVars `difference` UniversiallyQuantifiedVars,
         LinkingVar),
 
         % Set up mapping between the variables in the two calls.
-    assoc_list__from_corresponding_lists(VarsA, VarsB, Vars).
+    assoc_list.from_corresponding_lists(VarsA, VarsB, Vars).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__is_construction_equivalence_assertion(AssertId, Module,
-        ConsId, PredId) :-
-    assertion__goal(AssertId, Module, Goal),
+is_construction_equivalence_assertion(AssertId, Module, ConsId, PredId) :-
+    goal(AssertId, Module, Goal),
     equivalent(Goal, P, Q),
     ( single_construction(P, ConsId) ->
         predicate_call(Q, PredId)
@@ -434,17 +433,17 @@
 :- pred predicate_call(hlds_goal::in, pred_id::in) is semidet.
 
 predicate_call(Goal, PredId) :-
-    ( Goal = conj(Goals) - _ ->
-        list__member(Call, Goals),
+    ( Goal = conj(plain_conj, Goals) - _ ->
+        list.member(Call, Goals),
         Call = call(PredId, _, _, _, _, _) - _,
-        list__delete(Goals, Call, Unifications),
+        list.delete(Goals, Call, Unifications),
         P = (pred(G::in) is semidet :-
             not (
                 G = unify(_, UnifyRhs, _, _, _) - _,
                 UnifyRhs = functor(_, _, _)
             )
         ),
-        list__filter(P, Unifications, [])
+        list.filter(P, Unifications, [])
     ;
         Goal = call(PredId, _, _, _, _, _) - _
     ).
@@ -452,16 +451,16 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__goal(AssertId, Module, Goal) :-
+goal(AssertId, Module, Goal) :-
     module_info_get_assertion_table(Module, AssertTable),
     assertion_table_lookup(AssertTable, AssertId, PredId),
     module_info_pred_info(Module, PredId, PredInfo),
     pred_info_clauses_info(PredInfo, ClausesInfo),
     clauses_info_clauses_only(ClausesInfo, Clauses),
     ( Clauses = [clause(_ProcIds, Goal0, _Lang, _Context)] ->
-        assertion__normalise_goal(Goal0, Goal)
+        normalise_goal(Goal0, Goal)
     ;
-        unexpected(this_file, "assertion__goal: not an assertion")
+        unexpected(this_file, "goal: not an assertion")
     ).
 
 %-----------------------------------------------------------------------------%
@@ -471,12 +470,12 @@
 
 implies(Goal, P, Q) :-
         % Goal = (P => Q)
-    Goal = not(conj(GoalList) - GI) - _,
-    list__reverse(GoalList) = [NotQ | Ps],
+    Goal = not(conj(plain_conj, GoalList) - GI) - _,
+    list.reverse(GoalList) = [NotQ | Ps],
     ( Ps = [P0] ->
         P = P0
     ;
-        P = conj(list__reverse(Ps)) - GI
+        P = conj(plain_conj, list.reverse(Ps)) - GI
     ),
     NotQ = not(Q) - _.
 
@@ -484,8 +483,8 @@
 
 equivalent(Goal, P, Q) :-
         % Goal = P <=> Q
-    Goal = conj([A, B]) - _GoalInfo,
-    map__init(Subst),
+    Goal = conj(plain_conj, [A, B]) - _GoalInfo,
+    map.init(Subst),
     implies(A, PA, QA),
     implies(B, QB, PB),
     equal_goals(PA, PB, Subst, _),
@@ -503,7 +502,7 @@
 :- pred equal_goals(hlds_goal::in, hlds_goal::in,
     subst::in, subst::out) is semidet.
 
-equal_goals(conj(GoalAs) - _, conj(GoalBs) - _, !Subst) :-
+equal_goals(conj(ConjType, GoalAs) - _, conj(ConjType, GoalBs) - _, !Subst) :-
     equal_goals_list(GoalAs, GoalBs, !Subst).
 equal_goals(call(PredId, _, VarsA, _, _, _) - _,
         call(PredId, _, VarsB, _, _, _) - _, !Subst) :-
@@ -538,11 +537,9 @@
     % and as such will not participate in assertions.
     ExtraA = [],
     ExtraB = [],
-    VarsA = list__map(foreign_arg_var, ArgsA),
-    VarsB = list__map(foreign_arg_var, ArgsB),
+    VarsA = list.map(foreign_arg_var, ArgsA),
+    VarsB = list.map(foreign_arg_var, ArgsB),
     equal_vars(VarsA, VarsB, !Subst).
-equal_goals(par_conj(GoalAs) - _, par_conj(GoalBs) - _, !Subst) :-
-    equal_goals_list(GoalAs, GoalBs, !Subst).
 equal_goals(shorthand(ShorthandGoalA) - GoalInfoA,
         shorthand(ShorthandGoalB) - GoalInfoB, !Subst) :-
     equal_goals_shorthand(ShorthandGoalA - GoalInfoA,
@@ -571,10 +568,10 @@
     is semidet.
 
 equal_var(VA, VB, !Subst) :-
-    ( map__search(!.Subst, VA, SubstVA) ->
+    ( map.search(!.Subst, VA, SubstVA) ->
         SubstVA = VB
     ;
-        map__insert(!.Subst, VA, VB, !:Subst)
+        map.insert(!.Subst, VA, VB, !:Subst)
     ).
 
 :- pred equal_vars(prog_vars::in, prog_vars::in, subst::in, subst::out)
@@ -623,12 +620,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__record_preds_used_in(Goal, AssertId, !Module) :-
+record_preds_used_in(Goal, AssertId, !Module) :-
         % Explicit lambda expression needed since
         % goal_calls_pred_id has multiple modes.
     P = (pred(PredId::out) is nondet :- goal_calls_pred_id(Goal, PredId)),
     solutions(P, PredIds),
-    list__foldl(update_pred_info(AssertId), PredIds, !Module).
+    list.foldl(update_pred_info(AssertId), PredIds, !Module).
 
 %-----------------------------------------------------------------------------%
 
@@ -643,84 +640,87 @@
 update_pred_info(AssertId, PredId, !Module) :-
     module_info_pred_info(!.Module, PredId, PredInfo0),
     pred_info_get_assertions(PredInfo0, Assertions0),
-    set__insert(Assertions0, AssertId, Assertions),
+    set.insert(Assertions0, AssertId, Assertions),
     pred_info_set_assertions(Assertions, PredInfo0, PredInfo),
     module_info_set_pred_info(PredId, PredInfo, !Module).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__normalise_goal(Goal @ call(_, _, _, _, _, _) - GI, Goal - GI).
-assertion__normalise_goal(Goal @ generic_call(_, _, _, _) - GI, Goal - GI).
-assertion__normalise_goal(Goal @ unify(_, _, _, _, _) - GI, Goal - GI).
-assertion__normalise_goal(Goal @ foreign_proc(_, _, _, _, _, _) - GI,
-        Goal - GI).
-assertion__normalise_goal(conj(Goals0) - GI, conj(Goals) - GI) :-
-    assertion__normalise_conj(Goals0, Goals).
-assertion__normalise_goal(switch(A,B,Case0s) - GI, switch(A,B,Cases)-GI) :-
-    assertion__normalise_cases(Case0s, Cases).
-assertion__normalise_goal(disj(Goal0s) - GI, disj(Goals) - GI) :-
-    assertion__normalise_goals(Goal0s, Goals).
-assertion__normalise_goal(not(Goal0) - GI, not(Goal) - GI) :-
-    assertion__normalise_goal(Goal0, Goal).
-assertion__normalise_goal(scope(Reason, Goal0) - GI,
+normalise_goal(Goal @ call(_, _, _, _, _, _) - GI, Goal - GI).
+normalise_goal(Goal @ generic_call(_, _, _, _) - GI, Goal - GI).
+normalise_goal(Goal @ unify(_, _, _, _, _) - GI, Goal - GI).
+normalise_goal(Goal @ foreign_proc(_, _, _, _, _, _) - GI, Goal - GI).
+normalise_goal(conj(ConjType, Goals0) - GI,
+        conj(ConjType, Goals) - GI) :-
+    (
+        ConjType = plain_conj,
+        normalise_conj(Goals0, Goals)
+    ;
+        ConjType = parallel_conj,
+        normalise_goals(Goals0, Goals)
+    ).
+normalise_goal(switch(A,B,Case0s) - GI, switch(A,B,Cases)-GI) :-
+    normalise_cases(Case0s, Cases).
+normalise_goal(disj(Goal0s) - GI, disj(Goals) - GI) :-
+    normalise_goals(Goal0s, Goals).
+normalise_goal(not(Goal0) - GI, not(Goal) - GI) :-
+    normalise_goal(Goal0, Goal).
+normalise_goal(scope(Reason, Goal0) - GI,
         scope(Reason, Goal) - GI) :-
-    assertion__normalise_goal(Goal0, Goal).
-assertion__normalise_goal(if_then_else(A, If0, Then0, Else0) - GI,
+    normalise_goal(Goal0, Goal).
+normalise_goal(if_then_else(A, If0, Then0, Else0) - GI,
         if_then_else(A, If, Then, Else) - GI) :-
-    assertion__normalise_goal(If0, If),
-    assertion__normalise_goal(Then0, Then),
-    assertion__normalise_goal(Else0, Else).
-assertion__normalise_goal(par_conj(Goal0s) - GI, par_conj(Goals) - GI) :-
-    assertion__normalise_goals(Goal0s, Goals).
-assertion__normalise_goal(shorthand(ShortHandGoal0) - GI0,
+    normalise_goal(If0, If),
+    normalise_goal(Then0, Then),
+    normalise_goal(Else0, Else).
+normalise_goal(shorthand(ShortHandGoal0) - GI0,
         shorthand(ShortHandGoal) - GI) :-
-    assertion__normalise_goal_shorthand(ShortHandGoal0 - GI0,
-        ShortHandGoal - GI).
+    normalise_goal_shorthand(ShortHandGoal0 - GI0, ShortHandGoal - GI).
 
     % Place a shorthand goal into a standard form. Currently
     % all the code does is replace conj([G]) with G.
     %
-:- pred assertion__normalise_goal_shorthand(
+:- pred normalise_goal_shorthand(
     pair(shorthand_goal_expr, hlds_goal_info)::in,
     pair(shorthand_goal_expr, hlds_goal_info)::out) is det.
 
-assertion__normalise_goal_shorthand(bi_implication(LHS0, RHS0) - GI,
+normalise_goal_shorthand(bi_implication(LHS0, RHS0) - GI,
         bi_implication(LHS, RHS) - GI) :-
-    assertion__normalise_goal(LHS0, LHS),
-    assertion__normalise_goal(RHS0, RHS).
+    normalise_goal(LHS0, LHS),
+    normalise_goal(RHS0, RHS).
 
 %-----------------------------------------------------------------------------%
 
-:- pred assertion__normalise_conj(hlds_goals::in, hlds_goals::out) is det.
+:- pred normalise_conj(hlds_goals::in, hlds_goals::out) is det.
 
-assertion__normalise_conj([], []).
-assertion__normalise_conj([Goal0 | Goal0s], Goals) :-
+normalise_conj([], []).
+normalise_conj([Goal0 | Goal0s], Goals) :-
     goal_to_conj_list(Goal0, ConjGoals),
-    assertion__normalise_conj(Goal0s, Goal1s),
-    list__append(ConjGoals, Goal1s, Goals).
+    normalise_conj(Goal0s, Goal1s),
+    list.append(ConjGoals, Goal1s, Goals).
 
-:- pred assertion__normalise_cases(list(case)::in, list(case)::out) is det.
+:- pred normalise_cases(list(case)::in, list(case)::out) is det.
 
-assertion__normalise_cases([], []).
-assertion__normalise_cases([Case0 | Case0s], [Case | Cases]) :-
+normalise_cases([], []).
+normalise_cases([Case0 | Case0s], [Case | Cases]) :-
     Case0 = case(ConsId, Goal0),
-    assertion__normalise_goal(Goal0, Goal),
+    normalise_goal(Goal0, Goal),
     Case = case(ConsId, Goal),
-    assertion__normalise_cases(Case0s, Cases).
+    normalise_cases(Case0s, Cases).
 
-:- pred assertion__normalise_goals(hlds_goals::in, hlds_goals::out) is det.
+:- pred normalise_goals(hlds_goals::in, hlds_goals::out) is det.
 
-assertion__normalise_goals([], []).
-assertion__normalise_goals([Goal0 | Goal0s], [Goal | Goals]) :-
-    assertion__normalise_goal(Goal0, Goal),
-    assertion__normalise_goals(Goal0s, Goals).
+normalise_goals([], []).
+normalise_goals([Goal0 | Goal0s], [Goal | Goals]) :-
+    normalise_goal(Goal0, Goal),
+    normalise_goals(Goal0s, Goals).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-assertion__in_interface_check(call(PredId,_,_,_,_,SymName) - GoalInfo,
-        _PredInfo, !Module, !IO) :-
+in_interface_check(call(PredId,_,_,_,_,SymName) - GoalInfo, _PredInfo,
+        !Module, !IO) :-
     module_info_pred_info(!.Module, PredId, CallPredInfo),
     pred_info_import_status(CallPredInfo, ImportStatus),
     ( is_defined_in_implementation_section(ImportStatus) = yes ->
@@ -732,14 +732,12 @@
     ;
         true
     ).
-assertion__in_interface_check(generic_call(_, _, _, _) - _, _,
-        !Module, !IO).
-assertion__in_interface_check(unify(Var, RHS, _, _, _) - GoalInfo,
-        PredInfo, !Module, !IO) :-
+in_interface_check(generic_call(_, _, _, _) - _, _, !Module, !IO).
+in_interface_check(unify(Var, RHS, _, _, _) - GoalInfo, PredInfo,
+        !Module, !IO) :-
     goal_info_get_context(GoalInfo, Context),
-    assertion__in_interface_check_unify_rhs(RHS, Var, Context,
-        PredInfo, !Module, !IO).
-assertion__in_interface_check(foreign_proc(_, PredId, _, _, _, _) -
+    in_interface_check_unify_rhs(RHS, Var, Context, PredInfo, !Module, !IO).
+in_interface_check(foreign_proc(_, PredId, _, _, _, _) -
         GoalInfo, _PredInfo, !Module, !IO) :-
     module_info_pred_info(!.Module, PredId, PragmaPredInfo),
     pred_info_import_status(PragmaPredInfo, ImportStatus),
@@ -754,54 +752,49 @@
     ;
         true
     ).
-assertion__in_interface_check(conj(Goals) - _, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check_list(Goals, PredInfo, !Module, !IO).
-assertion__in_interface_check(switch(_, _, _) - _, _, _, _, !IO) :-
-    unexpected(this_file,
-        "assertion__in_interface_check: assertion contains switch.").
-assertion__in_interface_check(disj(Goals) - _, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check_list(Goals, PredInfo, !Module, !IO).
-assertion__in_interface_check(not(Goal) - _, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check(Goal, PredInfo, !Module, !IO).
-assertion__in_interface_check(scope(_, Goal) - _, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check(Goal, PredInfo, !Module, !IO).
-assertion__in_interface_check(if_then_else(_, If, Then, Else) - _,
-        PredInfo, !Module, !IO) :-
-    assertion__in_interface_check(If, PredInfo, !Module, !IO),
-    assertion__in_interface_check(Then, PredInfo, !Module, !IO),
-    assertion__in_interface_check(Else, PredInfo, !Module, !IO).
-assertion__in_interface_check(par_conj(Goals) - _, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check_list(Goals, PredInfo, !Module, !IO).
-assertion__in_interface_check(shorthand(ShorthandGoal) - _GoalInfo, PredInfo,
+in_interface_check(conj(_, Goals) - _, PredInfo, !Module, !IO) :-
+    in_interface_check_list(Goals, PredInfo, !Module, !IO).
+in_interface_check(switch(_, _, _) - _, _, _, _, !IO) :-
+    unexpected(this_file, "in_interface_check: assertion contains switch.").
+in_interface_check(disj(Goals) - _, PredInfo, !Module, !IO) :-
+    in_interface_check_list(Goals, PredInfo, !Module, !IO).
+in_interface_check(not(Goal) - _, PredInfo, !Module, !IO) :-
+    in_interface_check(Goal, PredInfo, !Module, !IO).
+in_interface_check(scope(_, Goal) - _, PredInfo, !Module, !IO) :-
+    in_interface_check(Goal, PredInfo, !Module, !IO).
+in_interface_check(if_then_else(_, If, Then, Else) - _, PredInfo,
         !Module, !IO) :-
-    assertion__in_interface_check_shorthand(ShorthandGoal,
-        PredInfo, !Module, !IO).
+    in_interface_check(If, PredInfo, !Module, !IO),
+    in_interface_check(Then, PredInfo, !Module, !IO),
+    in_interface_check(Else, PredInfo, !Module, !IO).
+in_interface_check(shorthand(ShorthandGoal) - _GoalInfo, PredInfo,
+        !Module, !IO) :-
+    in_interface_check_shorthand(ShorthandGoal, PredInfo, !Module, !IO).
 
-:- pred assertion__in_interface_check_shorthand(shorthand_goal_expr::in,
-    pred_info::in, module_info::in, module_info::out,
-    io::di, io::uo) is det.
+:- pred in_interface_check_shorthand(shorthand_goal_expr::in,
+    pred_info::in, module_info::in, module_info::out, io::di, io::uo) is det.
 
-assertion__in_interface_check_shorthand(bi_implication(LHS, RHS), PredInfo,
+in_interface_check_shorthand(bi_implication(LHS, RHS), PredInfo,
         !Module, !IO) :-
-    assertion__in_interface_check(LHS, PredInfo, !Module, !IO),
-    assertion__in_interface_check(RHS, PredInfo, !Module, !IO).
+    in_interface_check(LHS, PredInfo, !Module, !IO),
+    in_interface_check(RHS, PredInfo, !Module, !IO).
 
 %-----------------------------------------------------------------------------%
 
-:- pred assertion__in_interface_check_unify_rhs(unify_rhs::in, prog_var::in,
+:- pred in_interface_check_unify_rhs(unify_rhs::in, prog_var::in,
     prog_context::in, pred_info::in, module_info::in, module_info::out,
     io::di, io::uo) is det.
 
-assertion__in_interface_check_unify_rhs(var(_), _, _, _, !Module, !IO).
-assertion__in_interface_check_unify_rhs(functor(ConsId, _, _), Var, Context,
+in_interface_check_unify_rhs(var(_), _, _, _, !Module, !IO).
+in_interface_check_unify_rhs(functor(ConsId, _, _), Var, Context,
         PredInfo, !Module, !IO) :-
     pred_info_clauses_info(PredInfo, ClausesInfo),
     clauses_info_vartypes(ClausesInfo, VarTypes),
-    map__lookup(VarTypes, Var, Type),
+    map.lookup(VarTypes, Var, Type),
     ( type_to_ctor_and_args(Type, TypeCtor, _) ->
         module_info_get_type_table(!.Module, Types),
-        map__lookup(Types, TypeCtor, TypeDefn),
-        hlds_data__get_type_defn_status(TypeDefn, TypeStatus),
+        map.lookup(Types, TypeCtor, TypeDefn),
+        hlds_data.get_type_defn_status(TypeDefn, TypeStatus),
         ( is_defined_in_implementation_section(TypeStatus) = yes ->
             write_assertion_interface_error(Context, cons(ConsId),
                 !Module, !IO)
@@ -810,22 +803,21 @@
         )
     ;
         unexpected(this_file,
-            "assertion__in_interface_check_unify_rhs: " ++
-            "type_to_ctor_and_args failed.")
+            "in_interface_check_unify_rhs: type_to_ctor_and_args failed.")
     ).
-assertion__in_interface_check_unify_rhs(lambda_goal(_,_,_,_,_,_,_,Goal),
+in_interface_check_unify_rhs(lambda_goal(_, _, _, _, _, _, _, Goal),
         _Var, _Context, PredInfo, !Module, !IO) :-
-    assertion__in_interface_check(Goal, PredInfo, !Module, !IO).
+    in_interface_check(Goal, PredInfo, !Module, !IO).
 
 %-----------------------------------------------------------------------------%
 
-:- pred assertion__in_interface_check_list(hlds_goals::in, pred_info::in,
+:- pred in_interface_check_list(hlds_goals::in, pred_info::in,
     module_info::in, module_info::out, io::di, io::uo)is det.
 
-assertion__in_interface_check_list([], _, !Module, !IO).
-assertion__in_interface_check_list([Goal0 | Goal0s], PredInfo, !Module, !IO) :-
-    assertion__in_interface_check(Goal0, PredInfo, !Module, !IO),
-    assertion__in_interface_check_list(Goal0s, PredInfo, !Module, !IO).
+in_interface_check_list([], _, !Module, !IO).
+in_interface_check_list([Goal0 | Goal0s], PredInfo, !Module, !IO) :-
+    in_interface_check(Goal0, PredInfo, !Module, !IO),
+    in_interface_check_list(Goal0s, PredInfo, !Module, !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -881,7 +873,7 @@
         words(IdStr), words("which is defined in the "),
         words("implementation section of module"),
         fixed(ModuleStr ++ ".")], !IO),
-    globals__io_lookup_bool_option(verbose_errors, VerboseErrors, !IO),
+    globals.io_lookup_bool_option(verbose_errors, VerboseErrors, !IO),
     (
         VerboseErrors = yes,
         write_error_pieces_not_first_line(Context, 0,
Index: compiler/build_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/build_mode_constraints.m,v
retrieving revision 1.11
diff -u -b -r1.11 build_mode_constraints.m
--- compiler/build_mode_constraints.m	23 Feb 2006 09:36:49 -0000	1.11
+++ compiler/build_mode_constraints.m	24 Feb 2006 02:14:58 -0000
@@ -296,8 +296,15 @@
 
         % Switch on GoalExpr for recursion
     (
-        GoalExpr = conj(Goals),
-        list.foldl(add_mc_vars_for_goal(PredId, ProgVarset), Goals, !VarInfo)
+        GoalExpr = conj(ConjType, Goals),
+        (
+            ConjType = plain_conj,
+            list.foldl(add_mc_vars_for_goal(PredId, ProgVarset), Goals,
+                !VarInfo)
+        ;
+            ConjType = parallel_conj
+            % XXX handle this
+        )
     ;
         GoalExpr = call(_, _, _, _, _, _)
     ;
@@ -323,8 +330,6 @@
     ;
         GoalExpr = foreign_proc(_, _, _, _, _, _)
     ;
-        GoalExpr = par_conj(_Goals)
-    ;
         GoalExpr = shorthand(_ShorthandGoalExpr)
     ).
 
@@ -405,9 +410,14 @@
     mode_constraints::out) is det.
 
 add_goal_expr_constraints(ModuleInfo, ProgVarset, PredId,
-        conj(Goals), Context, GoalPath, Nonlocals, !VarInfo, !Constraints) :-
-    list.foldl(add_goal_nonlocals_to_conjunct_production_maps(VarMap, PredId,
-        Nonlocals), Goals, conj_constraints_info_init, ConjConstraintsInfo),
+        conj(ConjType, Goals), Context, GoalPath, Nonlocals, !VarInfo,
+        !Constraints) :-
+    (
+        ConjType = plain_conj,
+        list.foldl(
+            add_goal_nonlocals_to_conjunct_production_maps(VarMap, PredId,
+                Nonlocals),
+            Goals, conj_constraints_info_init, ConjConstraintsInfo),
     VarMap = rep_var_map(!.VarInfo),
 
     list.foldl2(add_goal_constraints(ModuleInfo, ProgVarset, PredId),
@@ -416,7 +426,12 @@
         locals_positions(ConjConstraintsInfo), !Constraints),
     map.foldl2(add_nonlocal_var_conj_constraints(ProgVarset, PredId,
         Context, GoalPath), nonlocals_positions(ConjConstraintsInfo),
-        !VarInfo, !Constraints).
+            !VarInfo, !Constraints)
+    ;
+        ConjType = parallel_conj,
+        % XXX Need to do something here.
+        sorry(this_file, "par_conj")
+    ).
 
 add_goal_expr_constraints(ModuleInfo, ProgVarset, CallerPredId, GoalExpr,
         Context, GoalPath, _Nonlocals, !VarInfo, !Constraints) :-
@@ -635,11 +650,6 @@
     ;
         unexpected(this_file, "no mode declaration for foreign proc")
     ).
-
-add_goal_expr_constraints(_ModuleInfo, _ProgVarset, _PredId,
-        par_conj(_Goals), _Context, _GoalPath, _Nonlocals, _, _, _, _) :-
-    % XXX Need to do something here.
-    sorry(this_file, "par_conj").
 
 add_goal_expr_constraints(_ModuleInfo, _ProgVarset, _PredId,
         shorthand(_ShorthandGoalExpr), _Context, _GoalPath, _Nonlocals,
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.97
diff -u -b -r1.97 bytecode_gen.m
--- compiler/bytecode_gen.m	23 Feb 2006 09:36:49 -0000	1.97
+++ compiler/bytecode_gen.m	24 Feb 2006 02:38:58 -0000
@@ -232,17 +232,26 @@
             label(EndLabel), endof_negation]),
         Code =  tree_list([EnterCode, SomeCode, EndofCode])
     ;
-        GoalExpr = scope(_, Goal),
-        gen_goal(Goal, !ByteInfo, SomeCode),
+        GoalExpr = scope(_, InnerGoal),
+        gen_goal(InnerGoal, !ByteInfo, InnerCode),
+        goal_info_get_determinism(GoalInfo, OuterDetism),
+        InnerGoal = _ - InnerGoalInfo,
+        goal_info_get_determinism(InnerGoalInfo, InnerDetism),
+        determinism_to_code_model(OuterDetism, OuterCodeModel),
+        determinism_to_code_model(InnerDetism, InnerCodeModel),
+        ( InnerCodeModel = OuterCodeModel ->
+            Code = InnerCode
+        ;
         get_next_temp(Temp, !ByteInfo),
         EnterCode = node([enter_commit(Temp)]),
         EndofCode = node([endof_commit(Temp)]),
-        Code = tree_list([EnterCode, SomeCode, EndofCode])
+            Code = tree_list([EnterCode, InnerCode, EndofCode])
+        )
     ;
-        GoalExpr = conj(GoalList),
+        GoalExpr = conj(plain_conj, GoalList),
         gen_conj(GoalList, !ByteInfo, Code)
     ;
-        GoalExpr = par_conj(_GoalList),
+        GoalExpr = conj(parallel_conj, _GoalList),
         sorry(this_file, "bytecode_gen of parallel conjunction")
     ;
         GoalExpr = disj(GoalList),
Index: compiler/clause_to_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.61
diff -u -b -r1.61 clause_to_proc.m
--- compiler/clause_to_proc.m	24 Feb 2006 01:41:44 -0000	1.61
+++ compiler/clause_to_proc.m	24 Feb 2006 01:44:18 -0000
@@ -408,7 +408,7 @@
     HeadVars = ExtraHeadVars ++ OrigHeadVars,
     set__list_to_set(HeadVars, NonLocals),
     goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
-    Body = conj(Goals) - GoalInfo,
+    Body = conj(plain_conj, Goals) - GoalInfo,
     proc_info_set_body(VarSet, VarTypes, HeadVars, Body, RttiVarMaps,
         !ProcInfo).
 
Index: compiler/closure_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/closure_analysis.m,v
retrieving revision 1.5
diff -u -b -r1.5 closure_analysis.m
--- compiler/closure_analysis.m	24 Feb 2006 01:41:45 -0000	1.5
+++ compiler/closure_analysis.m	24 Feb 2006 01:44:18 -0000
@@ -179,10 +179,10 @@
     hlds_goal::in, hlds_goal::out, closure_info::in, closure_info::out) is det.
 
 process_goal(VarTypes, ModuleInfo, Goal0, Goal, !ClosureInfo) :-
-    Goal0 = conj(Goals0) - GoalInfo,
+    Goal0 = conj(ConjType, Goals0) - GoalInfo,
     list.map_foldl(process_goal(VarTypes, ModuleInfo), Goals0, Goals,
         !ClosureInfo),
-    Goal = conj(Goals) - GoalInfo.
+    Goal = conj(ConjType, Goals) - GoalInfo.
 process_goal(VarTypes, ModuleInfo, Goal0, Goal, !ClosureInfo) :-
     Goal0 = GoalExpr - GoalInfo0,
     GoalExpr =  call(CallPredId, CallProcId, CallArgs, _, _, _),
@@ -383,11 +383,6 @@
     list.filter_map(ForeignHOArgs, Args, OutputForeignHOArgs),
     svmap.det_insert_from_assoc_list(OutputForeignHOArgs, !ClosureInfo),
     Goal = GoalExpr - GoalInfo. 
-process_goal(VarTypes, ModuleInfo, Goal0, Goal, !ClosureInfo) :-
-    Goal0 = par_conj(Goals0) - GoalInfo,
-    list.map_foldl(process_goal(VarTypes, ModuleInfo), Goals0, Goals,
-        !ClosureInfo),
-    Goal = par_conj(Goals) - GoalInfo.
 process_goal(_, _, shorthand(_) - _, _, _, _) :-
     unexpected(this_file, "shorthand/1 goal during closure analysis.").
 
@@ -445,9 +440,7 @@
 :- pred dump_closure_info(prog_varset::in, hlds_goal::in,
     io::di, io::uo) is det.
 
-dump_closure_info(Varset, conj(Goals) - _, !IO) :-
-    list.foldl(dump_closure_info(Varset), Goals, !IO).
-dump_closure_info(Varset, par_conj(Goals) - _, !IO) :-
+dump_closure_info(Varset, conj(_ConjType, Goals) - _, !IO) :-
     list.foldl(dump_closure_info(Varset), Goals, !IO).
 dump_closure_info(Varset, call(_,_,_,_,_,_) - GoalInfo, !IO) :-
     dump_ho_values(GoalInfo, Varset, !IO).
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.150
diff -u -b -r1.150 code_gen.m
--- compiler/code_gen.m	23 Feb 2006 09:36:49 -0000	1.150
+++ compiler/code_gen.m	24 Feb 2006 02:29:40 -0000
@@ -59,13 +59,13 @@
 
     % Translate a HLDS goal to LLDS.
     %
-:- pred code_gen__generate_goal(code_model::in, hlds_goal::in, code_tree::out,
+:- pred generate_goal(code_model::in, hlds_goal::in, code_tree::out,
     code_info::in, code_info::out) is det.
 
     % Return the message that identifies the procedure to pass to
     % the incr_sp_push_msg macro in the generated C code.
     %
-:- func code_gen__push_msg(module_info, pred_id, proc_id) = string.
+:- func push_msg(module_info, pred_id, proc_id) = string.
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
@@ -299,7 +299,7 @@
         % The set of recorded live values at calls (for value numbering)
         % and returns (for accurate gc and execution tracing) do not yet record
         % the stack slot holding the succip, so add it to those sets.
-        code_gen__add_saved_succip(Instructions0,
+        add_saved_succip(Instructions0,
             SuccipSlot, Instructions)
     ;
         MaybeSuccipSlot = no,
@@ -394,7 +394,7 @@
         goal_has_foreign(Goal) = no
     ->
         EmptyLabelCounter = counter__init(0),
-        code_gen__bytecode_stub(ModuleInfo, PredId, ProcId,
+        bytecode_stub(ModuleInfo, PredId, ProcId,
             BytecodeInstructions),
         Proc = c_procedure(Name, Arity, proc(PredId, ProcId),
             BytecodeInstructions, ProcLabel, EmptyLabelCounter, MayAlterRtti)
@@ -503,7 +503,7 @@
     % has set up the code generator state to reflect what the machine
     % state will be on entry to the procedure. Ensuring that the
     % machine state at exit will conform to the expectation
-    % of the caller is the job of code_gen__generate_exit.
+    % of the caller is the job of generate_exit.
     %
     % The reason why we generate the entry code after the body is that
     % information such as the total number of stack slots needed,
@@ -515,12 +515,12 @@
     % Code_gen__generate_entry cannot depend on the code generator
     % state, since when it is invoked this state is not appropriate
     % for the procedure entry. Nor can it change the code generator state,
-    % since that would confuse code_gen__generate_exit.
+    % since that would confuse generate_exit.
     %
     % Generating CALL trace events is done by generate_category_code,
     % since only on entry to generate_category_code is the code generator
     % state set up right. Generating EXIT trace events is done by
-    % code_gen__generate_exit. Generating FAIL trace events is done
+    % generate_exit. Generating FAIL trace events is done
     % by generate_category_code, since this requires modifying how
     % we generate code for the body of the procedure (failures must
     % now branch to a different place). Since FAIL trace events are
@@ -569,10 +569,10 @@
             TraceCallCode = empty,
             MaybeTraceCallLabel = no
         ),
-        code_gen__generate_goal(model_det, Goal, BodyCode, !CI),
-        code_gen__generate_entry(!.CI, model_det, Goal, ResumePoint,
+        generate_goal(model_det, Goal, BodyCode, !CI),
+        generate_entry(!.CI, model_det, Goal, ResumePoint,
             FrameInfo, EntryCode),
-        code_gen__generate_exit(model_det, FrameInfo, TraceSlotInfo,
+        generate_exit(model_det, FrameInfo, TraceSlotInfo,
             BodyContext, _, ExitCode, !CI),
         Code = tree_list([EntryCode, TraceCallCode, BodyCode, ExitCode])
     ).
@@ -602,10 +602,10 @@
                 "generate_category_code: call events suppressed")
         ),
         MaybeTraceCallLabel = yes(TraceCallLabel),
-        code_gen__generate_goal(model_semi, Goal, BodyCode, !CI),
-        code_gen__generate_entry(!.CI, model_semi, Goal, ResumePoint,
+        generate_goal(model_semi, Goal, BodyCode, !CI),
+        generate_entry(!.CI, model_semi, Goal, ResumePoint,
             FrameInfo, EntryCode),
-        code_gen__generate_exit(model_semi, FrameInfo, TraceSlotInfo,
+        generate_exit(model_semi, FrameInfo, TraceSlotInfo,
             BodyContext, RestoreDeallocCode, ExitCode, !CI),
 
         code_info__generate_resume_point(ResumePoint, ResumeCode, !CI),
@@ -628,10 +628,10 @@
     ;
         MaybeTraceInfo = no,
         MaybeTraceCallLabel = no,
-        code_gen__generate_goal(model_semi, Goal, BodyCode, !CI),
-        code_gen__generate_entry(!.CI, model_semi, Goal, ResumePoint,
+        generate_goal(model_semi, Goal, BodyCode, !CI),
+        generate_entry(!.CI, model_semi, Goal, ResumePoint,
             FrameInfo, EntryCode),
-        code_gen__generate_exit(model_semi, FrameInfo, TraceSlotInfo,
+        generate_exit(model_semi, FrameInfo, TraceSlotInfo,
             BodyContext, RestoreDeallocCode, ExitCode, !CI),
         code_info__generate_resume_point(ResumePoint, ResumeCode, !CI),
         Code = tree_list([EntryCode, BodyCode, ExitCode,
@@ -657,10 +657,10 @@
                 "generate_category_code: call events suppressed")
         ),
         MaybeTraceCallLabel = yes(TraceCallLabel),
-        code_gen__generate_goal(model_non, Goal, BodyCode, !CI),
-        code_gen__generate_entry(!.CI, model_non, Goal, ResumePoint,
+        generate_goal(model_non, Goal, BodyCode, !CI),
+        generate_entry(!.CI, model_non, Goal, ResumePoint,
             FrameInfo, EntryCode),
-        code_gen__generate_exit(model_non, FrameInfo, TraceSlotInfo,
+        generate_exit(model_non, FrameInfo, TraceSlotInfo,
             BodyContext, _, ExitCode, !CI),
 
         code_info__generate_resume_point(ResumePoint, ResumeCode, !CI),
@@ -710,10 +710,10 @@
     ;
         MaybeTraceInfo = no,
         MaybeTraceCallLabel = no,
-        code_gen__generate_goal(model_non, Goal, BodyCode, !CI),
-        code_gen__generate_entry(!.CI, model_non, Goal, ResumePoint,
+        generate_goal(model_non, Goal, BodyCode, !CI),
+        generate_entry(!.CI, model_non, Goal, ResumePoint,
             FrameInfo, EntryCode),
-        code_gen__generate_exit(model_non, FrameInfo, TraceSlotInfo,
+        generate_exit(model_non, FrameInfo, TraceSlotInfo,
             BodyContext, _, ExitCode, !CI),
         Code = tree_list([EntryCode, BodyCode, ExitCode])
     ).
@@ -739,10 +739,10 @@
     % need a stack frame, and if the procedure is nondet, then the code
     % to fill in the succip slot is subsumed by the mkframe.
 
-:- pred code_gen__generate_entry(code_info::in, code_model::in, hlds_goal::in,
+:- pred generate_entry(code_info::in, code_model::in, hlds_goal::in,
     resume_point_info::in, frame_info::out, code_tree::out) is det.
 
-code_gen__generate_entry(CI, CodeModel, Goal, OutsideResumePoint, FrameInfo,
+generate_entry(CI, CodeModel, Goal, OutsideResumePoint, FrameInfo,
         EntryCode) :-
     code_info__get_stack_slots(CI, StackSlots),
     code_info__get_varset(CI, VarSet),
@@ -790,7 +790,7 @@
     PredName = pred_info_name(PredInfo),
     Arity = pred_info_orig_arity(PredInfo),
 
-    PushMsg = code_gen__push_msg(ModuleInfo, PredId, ProcId),
+    PushMsg = push_msg(ModuleInfo, PredId, ProcId),
     ( CodeModel = model_non ->
         code_info__resume_point_stack_addr(OutsideResumePoint,
             OutsideResumeAddress),
@@ -869,11 +869,11 @@
     % of the epilogue are handled when traversing the pragma C code goal;
     % we need only #undef a macro defined by the procedure prologue.
 
-:- pred code_gen__generate_exit(code_model::in, frame_info::in,
+:- pred generate_exit(code_model::in, frame_info::in,
     trace_slot_info::in, prog_context::in, code_tree::out, code_tree::out,
     code_info::in, code_info::out) is det.
 
-code_gen__generate_exit(CodeModel, FrameInfo, TraceSlotInfo, BodyContext,
+generate_exit(CodeModel, FrameInfo, TraceSlotInfo, BodyContext,
         RestoreDeallocCode, ExitCode, !CI) :-
     StartComment = node([
         comment("Start of procedure epilogue") - ""
@@ -1046,7 +1046,7 @@
 
 %---------------------------------------------------------------------------%
 
-code_gen__generate_goal(ContextModel, Goal - GoalInfo, Code, !CI) :-
+generate_goal(ContextModel, Goal - GoalInfo, Code, !CI) :-
     % Generate a goal. This predicate arranges for the necessary updates of
     % the generic data structures before and after the actual code generation,
     % which is delegated to goal-specific predicates.
@@ -1086,7 +1086,7 @@
         %
         code_info__get_globals(!.CI, Globals),
         AddTrailOps = should_add_trail_ops(Globals, Goal - GoalInfo),
-        code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, AddTrailOps, 
+        generate_goal_2(Goal, GoalInfo, CodeModel, AddTrailOps, 
             GoalCode, !CI),
         goal_info_get_features(GoalInfo, Features),
         code_info__get_proc_info(!.CI, ProcInfo),
@@ -1132,8 +1132,7 @@
             set__member(save_deep_excp_vars, Features)
         ->
             DeepSaveVars = compute_deep_save_excp_vars(ProcInfo),
-            code_info__save_variables_on_stack(DeepSaveVars, DeepSaveCode,
-                !CI),
+            save_variables_on_stack(DeepSaveVars, DeepSaveCode, !CI),
             Code = tree(CodeUptoTip, DeepSaveCode)
         ;
             Code = CodeUptoTip
@@ -1180,40 +1179,42 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__generate_goal_2(hlds_goal_expr::in, hlds_goal_info::in,
+:- pred generate_goal_2(hlds_goal_expr::in, hlds_goal_info::in,
     code_model::in, add_trail_ops::in, code_tree::out,
     code_info::in, code_info::out) is det.
 
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
     Goal = unify(_, _, _, Uni, _),
     unify_gen__generate_unification(CodeModel, Uni, GoalInfo, Code, !CI).
-code_gen__generate_goal_2(conj(Goals), _GoalInfo, CodeModel, _, Code, !CI) :-
-    code_gen__generate_goals(Goals, CodeModel, Code, !CI).
-code_gen__generate_goal_2(par_conj(Goals), GoalInfo, CodeModel, _, Code, !CI) :-
-    par_conj_gen__generate_par_conj(Goals, GoalInfo, CodeModel, Code, !CI).
-code_gen__generate_goal_2(disj(Goals), GoalInfo, CodeModel, AddTrailOps,
-        Code, !CI) :-
+generate_goal_2(conj(ConjType, Goals), GoalInfo, CodeModel, _, Code, !CI) :-
+    (
+        ConjType = plain_conj,
+        generate_goals(Goals, CodeModel, Code, !CI)
+    ;
+        ConjType = parallel_conj,
+        par_conj_gen__generate_par_conj(Goals, GoalInfo, CodeModel, Code, !CI)
+    ).
+generate_goal_2(disj(Goals), GoalInfo, CodeModel, AddTrailOps, Code, !CI) :-
     disj_gen__generate_disj(AddTrailOps, CodeModel, Goals, GoalInfo, Code, !CI).
-code_gen__generate_goal_2(not(Goal), GoalInfo, CodeModel, AddTrailOps,
-        Code, !CI) :-
+generate_goal_2(not(Goal), GoalInfo, CodeModel, AddTrailOps, Code, !CI) :-
     ite_gen__generate_negation(AddTrailOps, CodeModel, Goal, GoalInfo,
         Code, !CI).
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, AddTrailOps, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, AddTrailOps, Code, !CI) :-
     Goal = if_then_else(_Vars, Cond, Then, Else),
     ite_gen__generate_ite(AddTrailOps, CodeModel, Cond, Then, Else, GoalInfo,
         Code, !CI).
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
     Goal = switch(Var, CanFail, CaseList),
     switch_gen__generate_switch(CodeModel, Var, CanFail, CaseList,
         GoalInfo, Code, !CI).
-code_gen__generate_goal_2(scope(_, Goal), _GoalInfo, CodeModel, AddTrailOps,
-        Code, !CI) :-
+generate_goal_2(scope(_, Goal), _GoalInfo, CodeModel, AddTrailOps, Code,
+        !CI) :-
     commit_gen__generate_commit(AddTrailOps, CodeModel, Goal, Code, !CI).
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
     Goal = generic_call(GenericCall, Args, Modes, Det),
     call_gen__generate_generic_call(CodeModel, GenericCall, Args,
         Modes, Det, GoalInfo, Code, !CI).
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
     Goal = call(PredId, ProcId, Args, BuiltinState, _, _),
     ( BuiltinState = not_builtin ->
         call_gen__generate_call(CodeModel, PredId, ProcId, Args,
@@ -1222,7 +1223,7 @@
         call_gen__generate_builtin(CodeModel, PredId, ProcId, Args,
             Code, !CI)
     ).
-code_gen__generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
+generate_goal_2(Goal, GoalInfo, CodeModel, _, Code, !CI) :-
     Goal = foreign_proc(Attributes, PredId, ProcId, Args, ExtraArgs,
         PragmaCode),
     ( c = foreign_language(Attributes) ->
@@ -1232,7 +1233,7 @@
         unexpected(this_file,
             "generate_goal_2: foreign code other than C unexpected")
     ).
-code_gen__generate_goal_2(shorthand(_), _, _, _, _, !CI) :-
+generate_goal_2(shorthand(_), _, _, _, _, !CI) :-
     % These should have been expanded out by now.
     unexpected(this_file, "generate_goal_2: unexpected shorthand").
 
@@ -1242,17 +1243,17 @@
     % conjunction, state information flows directly from one conjunct
     % to the next.
     %
-:- pred code_gen__generate_goals(hlds_goals::in, code_model::in,
+:- pred generate_goals(hlds_goals::in, code_model::in,
     code_tree::out, code_info::in, code_info::out) is det.
 
-code_gen__generate_goals([], _, empty, !CI).
-code_gen__generate_goals([Goal | Goals], CodeModel, Code, !CI) :-
-    code_gen__generate_goal(CodeModel, Goal, Code1, !CI),
+generate_goals([], _, empty, !CI).
+generate_goals([Goal | Goals], CodeModel, Code, !CI) :-
+    generate_goal(CodeModel, Goal, Code1, !CI),
     code_info__get_instmap(!.CI, Instmap),
     ( instmap__is_unreachable(Instmap) ->
         Code = Code1
     ;
-        code_gen__generate_goals(Goals, CodeModel, Code2, !CI),
+        generate_goals(Goals, CodeModel, Code2, !CI),
         Code = tree(Code1, Code2)
     ).
 
@@ -1262,11 +1263,11 @@
     % of instructions looking for livevals and calls, adding succip in the
     % stackvar number given as an argument.
     %
-:- pred code_gen__add_saved_succip(list(instruction)::in, int::in,
+:- pred add_saved_succip(list(instruction)::in, int::in,
     list(instruction)::out) is det.
 
-code_gen__add_saved_succip([], _StackLoc, []).
-code_gen__add_saved_succip([Instrn0 - Comment | Instrns0 ], StackLoc,
+add_saved_succip([], _StackLoc, []).
+add_saved_succip([Instrn0 - Comment | Instrns0 ], StackLoc,
         [Instrn - Comment | Instrns]) :-
     (
         Instrn0 = livevals(LiveVals0),
@@ -1286,14 +1287,14 @@
     ;
         Instrn = Instrn0
     ),
-    code_gen__add_saved_succip(Instrns0, StackLoc, Instrns).
+    add_saved_succip(Instrns0, StackLoc, Instrns).
 
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__bytecode_stub(module_info::in, pred_id::in, proc_id::in,
+:- pred bytecode_stub(module_info::in, pred_id::in, proc_id::in,
     list(instruction)::out) is det.
 
-code_gen__bytecode_stub(ModuleInfo, PredId, ProcId, BytecodeInstructions) :-
+bytecode_stub(ModuleInfo, PredId, ProcId, BytecodeInstructions) :-
 
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
     ModuleSymName = pred_info_module(PredInfo),
@@ -1349,9 +1350,11 @@
 
 %---------------------------------------------------------------------------%
 
-:- type type_giving_arg --->    last_arg ; last_but_one_arg.
+:- type type_giving_arg
+    --->    last_arg
+    ;       last_but_one_arg.
 
-code_gen__push_msg(ModuleInfo, PredId, ProcId) = PushMsg :-
+push_msg(ModuleInfo, PredId, ProcId) = PushMsg :-
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
     PredOrFunc = pred_info_is_pred_or_func(PredInfo),
     ModuleName = pred_info_module(PredInfo),
@@ -1359,7 +1362,7 @@
     Arity = pred_info_orig_arity(PredInfo),
     pred_info_get_origin(PredInfo, Origin),
     ( Origin = special_pred(SpecialId - TypeCtor) ->
-        code_gen__find_arg_type_ctor_name(TypeCtor, TypeName),
+        find_arg_type_ctor_name(TypeCtor, TypeName),
         SpecialPredName = get_special_pred_id_generic_name(SpecialId),
         FullPredName = SpecialPredName ++ "_for_" ++ TypeName
     ;
@@ -1373,9 +1376,9 @@
         FullPredName ++ "/" ++ int_to_string(Arity) ++ "-" ++
         int_to_string(proc_id_to_int(ProcId)).
 
-:- pred code_gen__find_arg_type_ctor_name((type_ctor)::in, string::out) is det.
+:- pred find_arg_type_ctor_name((type_ctor)::in, string::out) is det.
 
-code_gen__find_arg_type_ctor_name(TypeCtor, TypeName) :-
+find_arg_type_ctor_name(TypeCtor, TypeName) :-
     TypeCtor = TypeCtorSymName - TypeCtorArity,
     mdbcomp__prim_data__sym_name_to_string(TypeCtorSymName, TypeCtorName),
     string__int_to_string(TypeCtorArity, ArityStr),
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.163
diff -u -b -r1.163 code_util.m
--- compiler/code_util.m	3 Jan 2006 04:07:50 -0000	1.163
+++ compiler/code_util.m	17 Feb 2006 06:31:06 -0000
@@ -270,9 +270,7 @@
     ).
 goal_may_alloc_temp_frame_2(not(Goal), May) :-
     goal_may_alloc_temp_frame(Goal, May).
-goal_may_alloc_temp_frame_2(conj(Goals), May) :-
-    goal_list_may_alloc_temp_frame(Goals, May).
-goal_may_alloc_temp_frame_2(par_conj(Goals), May) :-
+goal_may_alloc_temp_frame_2(conj(_ConjType, Goals), May) :-
     goal_list_may_alloc_temp_frame(Goals, May).
 goal_may_alloc_temp_frame_2(disj(Goals), May) :-
     goal_list_may_alloc_temp_frame(Goals, May).
Index: compiler/common.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/common.m,v
retrieving revision 1.88
diff -u -b -r1.88 common.m
--- compiler/common.m	27 Jan 2006 05:52:03 -0000	1.88
+++ compiler/common.m	17 Feb 2006 02:18:45 -0000
@@ -380,7 +380,7 @@
             simplify_info_set_common_info(CommonInfo, !Info),
             create_output_unifications(GoalInfo0, ArgVars, OldArgVars,
                 UniModes, Goals, !Info),
-            Goal = conj(Goals),
+            Goal = conj(plain_conj, Goals),
             pd_cost__goal(Goal0 - GoalInfo0, Cost),
             simplify_info_incr_cost_delta(Cost, !Info),
             simplify_info_set_requantify(!Info),
@@ -564,7 +564,7 @@
             modes_to_uni_modes(ModuleInfo, Modes, Modes, UniModes),
             create_output_unifications(GoalInfo, OutputArgs, OutputArgs2,
                 UniModes, Goals, !Info),
-            Goal = conj(Goals),
+            Goal = conj(plain_conj, Goals),
             simplify_info_get_var_types(!.Info, VarTypes),
             (
                 simplify_do_warn_calls(!.Info),
Index: compiler/complexity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/complexity.m,v
retrieving revision 1.10
diff -u -b -r1.10 complexity.m
--- compiler/complexity.m	24 Feb 2006 01:41:45 -0000	1.10
+++ compiler/complexity.m	24 Feb 2006 01:44:19 -0000
@@ -323,13 +323,16 @@
 
     (
         CodeModel = model_det,
-        TransformedGoalExpr = conj(SlotGoals ++ [OrigGoal, ExitGoal]),
+        TransformedGoalExpr = conj(plain_conj,
+            SlotGoals ++ [OrigGoal, ExitGoal]),
         TransformedGoal = TransformedGoalExpr - ImpureOrigGoalInfo
     ;
         CodeModel = model_semi,
-        OrigAfterGoal = conj([OrigGoal, ExitGoal]) - ImpureOrigGoalInfo,
+        OrigAfterGoal = conj(plain_conj, [OrigGoal, ExitGoal])
+            - ImpureOrigGoalInfo,
         DisjGoal = disj([OrigAfterGoal, FailGoal]) - ImpureOrigGoalInfo,
-        TransformedGoal = conj(SlotGoals ++ [DisjGoal]) - ImpureOrigGoalInfo
+        TransformedGoal = conj(plain_conj,
+            SlotGoals ++ [DisjGoal]) - ImpureOrigGoalInfo
     ;
         CodeModel = model_non,
         RedoGoal0 = RedoGoalExpr - RedoGoalInfo0,
@@ -342,9 +345,11 @@
             multidet, purity_impure, Context, AfterGoalInfo),
         AfterGoal = disj([ExitGoal, RedoGoal]) - AfterGoalInfo,
 
-        OrigAfterGoal = conj([OrigGoal, AfterGoal]) - ImpureOrigGoalInfo,
+        OrigAfterGoal = conj(plain_conj, [OrigGoal, AfterGoal])
+            - ImpureOrigGoalInfo,
         DisjGoal = disj([OrigAfterGoal, FailGoal]) - ImpureOrigGoalInfo,
-        TransformedGoal = conj(SlotGoals ++ [DisjGoal]) - ImpureOrigGoalInfo
+        TransformedGoal = conj(plain_conj, SlotGoals ++ [DisjGoal])
+            - ImpureOrigGoalInfo
     ),
 
     mercury_term_size_prof_builtin_module(TSPB),
@@ -358,7 +363,7 @@
         Context, SwitchGoalInfo),
     SwitchGoal = SwitchExpr - SwitchGoalInfo,
 
-    GoalExpr = conj([IsActiveGoal, SwitchGoal]),
+    GoalExpr = conj(plain_conj, [IsActiveGoal, SwitchGoal]),
     goal_info_init(OrigNonLocals, OrigInstMapDelta, Detism, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo,
Index: compiler/const_prop.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/const_prop.m,v
retrieving revision 1.33
diff -u -b -r1.33 const_prop.m
--- compiler/const_prop.m	28 Nov 2005 04:11:39 -0000	1.33
+++ compiler/const_prop.m	18 Feb 2006 05:10:02 -0000
@@ -578,8 +578,8 @@
 
 :- pred make_true_or_fail(bool::in, hlds_goal_expr::out) is det.
 
-make_true_or_fail(yes, conj([])).
-make_true_or_fail(no, disj([])).
+make_true_or_fail(yes, true_goal_expr).
+make_true_or_fail(no, fail_goal_expr).
 
 %---------------------------------------------------------------------------%
 
Index: compiler/constraint.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/constraint.m,v
retrieving revision 1.70
diff -u -b -r1.70 constraint.m
--- compiler/constraint.m	21 Feb 2006 12:20:24 -0000	1.70
+++ compiler/constraint.m	24 Feb 2006 02:31:10 -0000
@@ -128,13 +128,24 @@
     list(hlds_goal)::out, constraint_info::in, constraint_info::out,
     io::di, io::uo) is det.
 
-propagate_conj_sub_goal_2(conj(Goals0) - Info, Constraints,
-        [conj(Goals) - Info], !Info, !IO) :-
-    propagate_conj(Goals0, Constraints, Goals, !Info, !IO).
+propagate_conj_sub_goal_2(conj(ConjType, Goals0) - GoalInfo, Constraints0,
+        [conj(ConjType, Goals) - GoalInfo | MoreGoals], !Info, !IO) :-
+    (
+        ConjType = plain_conj,
+        MoreGoals = [],
+        propagate_conj(Goals0, Constraints0, Goals, !Info, !IO)
+    ;
+        ConjType = parallel_conj,
+        % We can't propagate constraints into parallel conjunctions because
+        % parallel conjunctions must have determinism det. However, we can
+        % propagate constraints *within* the goals of the conjunction.
+        flatten_constraints(Constraints0, MoreGoals),
+        propagate_in_independent_goals(Goals0, [], Goals, !Info, !IO)
+    ).
 
 propagate_conj_sub_goal_2(disj(Goals0) - Info, Constraints,
         [disj(Goals) - Info], !Info, !IO) :-
-    propagate_disj(Goals0, Constraints, Goals, !Info, !IO).
+    propagate_in_independent_goals(Goals0, Constraints, Goals, !Info, !IO).
 
 propagate_conj_sub_goal_2(switch(Var, CanFail, Cases0) - Info,
         Constraints, [switch(Var, CanFail, Cases) - Info], !Info, !IO) :-
@@ -146,28 +157,15 @@
         [if_then_else(Vars, Cond, Then, Else) - Info], !Info, !IO) :-
     InstMap0 = !.Info ^ instmap,
 
-    % We can't safely propagate constraints into
-    % the condition of an if-then-else, because that
-    % would change the answers generated by the procedure.
+    % We can't safely propagate constraints into the condition of an
+    % if-then-else, because that would change the answers generated
+    % by the procedure.
     propagate_goal(Cond0, [], Cond, !Info, !IO),
     constraint_info_update_goal(Cond, !Info),
     propagate_goal(Then0, Constraints, Then, !Info, !IO),
     !:Info = !.Info ^ instmap := InstMap0,
     propagate_goal(Else0, Constraints, Else, !Info, !IO).
 
-    % XXX propagate constraints into par_conjs -- this isn't
-    % possible at the moment because par_conj goals must have
-    % determinism det.
-propagate_conj_sub_goal_2(par_conj(Goals0) - GoalInfo,
-        Constraints0,
-        [par_conj(Goals) - GoalInfo | Constraints], !Info, !IO) :-
-    % Propagate constraints within the goals of the conjunction.
-    % propagate_disj treats its list of goals as
-    % independent rather than specifically disjoint, so we can
-    % use it to process a list of independent parallel conjuncts.
-    propagate_disj(Goals0, [], Goals, !Info, !IO),
-    flatten_constraints(Constraints0, Constraints).
-
 propagate_conj_sub_goal_2(scope(Reason, Goal0) - GoalInfo, Constraints,
         [scope(Reason, Goal) - GoalInfo], !Info, !IO) :-
     propagate_goal(Goal0, Constraints, Goal, !Info, !IO).
@@ -182,9 +180,8 @@
 
 propagate_conj_sub_goal_2(Goal, Constraints0,
         [Goal | Constraints], !Info, !IO) :-
-    % propagate_conj will move the constraints
-    % to the left of the call if that is possible, so nothing
-    % needs to be done here.
+    % propagate_conj will move the constraints to the left of the call
+    % if that is possible, so nothing needs to be done here.
     Goal = call(_, _, _, _, _, _) - _,
     flatten_constraints(Constraints0, Constraints).
 
@@ -198,15 +195,15 @@
     Goal = foreign_proc(_, _, _, _, _, _) - _,
     flatten_constraints(Constraints0, Constraints).
 
-propagate_conj_sub_goal_2(Goal, _, _, !Info, !IO) :-
-    Goal = shorthand(_) - _,
-    unexpected(this_file, "propagate_conj_sub_goal_2: shorthand").
-
 propagate_conj_sub_goal_2(Goal, Constraints0,
         [Goal | Constraints], !Info, !IO) :-
     Goal = unify(_, _, _, _, _) - _,
     flatten_constraints(Constraints0, Constraints).
 
+propagate_conj_sub_goal_2(Goal, _, _, !Info, !IO) :-
+    Goal = shorthand(_) - _,
+    unexpected(this_file, "propagate_conj_sub_goal_2: shorthand").
+
 %-----------------------------------------------------------------------------%
 
     % Put the constant constructions in front of the constraint.
@@ -223,16 +220,17 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred propagate_disj(hlds_goals::in, list(constraint)::in,
+:- pred propagate_in_independent_goals(hlds_goals::in, list(constraint)::in,
     hlds_goals::out, constraint_info::in, constraint_info::out,
     io::di, io::uo) is det.
 
-propagate_disj([], _, [], !Info, !IO).
-propagate_disj([Goal0 | Goals0], Constraints, [Goal | Goals], !Info, !IO) :-
+propagate_in_independent_goals([], _, [], !Info, !IO).
+propagate_in_independent_goals([Goal0 | Goals0], Constraints, [Goal | Goals],
+        !Info, !IO) :-
     InstMap0 = !.Info ^ instmap,
     propagate_goal(Goal0, Constraints, Goal, !Info, !IO),
     !:Info = !.Info ^ instmap := InstMap0,
-    propagate_disj(Goals0, Constraints, Goals, !Info, !IO).
+    propagate_in_independent_goals(Goals0, Constraints, Goals, !Info, !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -821,8 +819,8 @@
 
 :- func strip_constraint_markers_expr(hlds_goal_expr) = hlds_goal_expr.
 
-strip_constraint_markers_expr(conj(Goals)) =
-        conj(list__map(strip_constraint_markers, Goals)).
+strip_constraint_markers_expr(conj(ConjType, Goals)) =
+        conj(ConjType, list.map(strip_constraint_markers, Goals)).
 strip_constraint_markers_expr(disj(Goals)) =
         disj(list__map(strip_constraint_markers, Goals)).
 strip_constraint_markers_expr(switch(Var, CanFail, Cases0)) =
@@ -836,11 +834,10 @@
 strip_constraint_markers_expr(scope(Reason, Goal)) =
         scope(Reason, strip_constraint_markers(Goal)).
 strip_constraint_markers_expr(if_then_else(Vars, If, Then, Else)) =
-        if_then_else(Vars, strip_constraint_markers(If),
+        if_then_else(Vars,
+            strip_constraint_markers(If),
             strip_constraint_markers(Then),
             strip_constraint_markers(Else)).
-strip_constraint_markers_expr(par_conj(Goals)) =
-        par_conj(list__map(strip_constraint_markers, Goals)).
 strip_constraint_markers_expr(Goal) = Goal :-
     Goal = foreign_proc(_, _, _, _, _, _).
 strip_constraint_markers_expr(Goal) = Goal :-
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.93
diff -u -b -r1.93 cse_detection.m
--- compiler/cse_detection.m	23 Feb 2006 09:36:50 -0000	1.93
+++ compiler/cse_detection.m	24 Feb 2006 02:47:11 -0000
@@ -260,12 +260,9 @@
 detect_cse_in_goal_2(scope(Reason, Goal0), _GoalInfo, InstMap,
         !CseInfo, Redo, scope(Reason, Goal)) :-
     detect_cse_in_goal(Goal0, InstMap, !CseInfo, Redo, Goal).
-detect_cse_in_goal_2(conj(Goals0), _GoalInfo, InstMap, !CseInfo, Redo,
-        conj(Goals)) :-
-    detect_cse_in_conj(Goals0, InstMap, !CseInfo, Redo, Goals).
-detect_cse_in_goal_2(par_conj(Goals0), _, InstMap, !CseInfo, Redo,
-        par_conj(Goals)) :-
-    detect_cse_in_par_conj(Goals0, InstMap, !CseInfo, Redo, Goals).
+detect_cse_in_goal_2(conj(ConjType, Goals0), _GoalInfo, InstMap, !CseInfo,
+        Redo, conj(ConjType, Goals)) :-
+    detect_cse_in_conj(Goals0, ConjType, InstMap, !CseInfo, Redo, Goals).
 detect_cse_in_goal_2(disj(Goals0), GoalInfo, InstMap, !CseInfo, Redo, Goal) :-
     ( Goals0 = [] ->
         Redo = no,
@@ -295,31 +292,23 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred detect_cse_in_conj(list(hlds_goal)::in, instmap::in, cse_info::in,
-    cse_info::out, bool::out, list(hlds_goal)::out) is det.
+:- pred detect_cse_in_conj(list(hlds_goal)::in, conj_type::in, instmap::in,
+    cse_info::in, cse_info::out, bool::out, list(hlds_goal)::out) is det.
 
-detect_cse_in_conj([], _InstMap, !CseInfo, no, []).
-detect_cse_in_conj([Goal0 | Goals0], InstMap0, !CseInfo, Redo, Goals) :-
-    detect_cse_in_goal_1(Goal0, InstMap0, !CseInfo, Redo1, Goal1, InstMap1),
-    detect_cse_in_conj(Goals0, InstMap1, !CseInfo, Redo2, Goals1),
-    ( Goal1 = conj(ConjGoals) - _ ->
-        list__append(ConjGoals, Goals1, Goals)
+detect_cse_in_conj([], _ConjType, _InstMap, !CseInfo, no, []).
+detect_cse_in_conj([Goal0 | Goals0], ConjType, InstMap0, !CseInfo, Redo,
+        Goals) :-
+    detect_cse_in_goal_1(Goal0, InstMap0, !CseInfo, Redo1, Goal, InstMap1),
+    detect_cse_in_conj(Goals0, ConjType, InstMap1, !CseInfo, Redo2, TailGoals),
+    (
+        Goal = conj(InnerConjType, ConjGoals) - _,
+        ConjType = InnerConjType
+    ->
+        Goals = ConjGoals ++ TailGoals
     ;
-        Goals = [Goal1 | Goals1]
+        Goals = [Goal | TailGoals]
     ),
-    bool__or(Redo1, Redo2, Redo).
-
-%-----------------------------------------------------------------------------%
-
-:- pred detect_cse_in_par_conj(list(hlds_goal)::in, instmap::in, cse_info::in,
-    cse_info::out, bool::out, list(hlds_goal)::out) is det.
-
-detect_cse_in_par_conj([], _InstMap, !CseInfo, no, []).
-detect_cse_in_par_conj([Goal0 | Goals0], InstMap0, !CseInfo, Redo,
-        [Goal | Goals]) :-
-    detect_cse_in_goal(Goal0, InstMap0, !CseInfo, Redo1, Goal),
-    detect_cse_in_par_conj(Goals0, InstMap0, !CseInfo, Redo2, Goals),
-    bool__or(Redo1, Redo2, Redo).
+    bool.or(Redo1, Redo2, Redo).
 
 %-----------------------------------------------------------------------------%
 
@@ -348,7 +337,7 @@
     ->
         maybe_update_existential_data_structures(Unify,
             FirstOldNew, LaterOldNew, !CseInfo),
-        Goal = conj([Unify, disj(Goals) - GoalInfo0]),
+        Goal = conj(plain_conj, [Unify, disj(Goals) - GoalInfo0]),
         Redo = yes
     ;
         detect_cse_in_disj(Vars, Goals0, GoalInfo0, InstMap,
@@ -386,7 +375,8 @@
     ->
         maybe_update_existential_data_structures(Unify,
             FirstOldNew, LaterOldNew, !CseInfo),
-        Goal = conj([Unify, switch(SwitchVar, CanFail, Cases) - GoalInfo]),
+        Goal = conj(plain_conj,
+            [Unify, switch(SwitchVar, CanFail, Cases) - GoalInfo]),
         Redo = yes
     ;
         detect_cse_in_cases(Vars, SwitchVar, CanFail, Cases0, GoalInfo,
@@ -428,7 +418,7 @@
     ->
         maybe_update_existential_data_structures(Unify,
             FirstOldNew, LaterOldNew, !CseInfo),
-        Goal = conj([Unify, if_then_else(IfVars, Cond0, Then, Else)
+        Goal = conj(plain_conj, [Unify, if_then_else(IfVars, Cond0, Then, Else)
             - GoalInfo]),
         Redo = yes
     ;
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.107
diff -u -b -r1.107 dead_proc_elim.m
--- compiler/dead_proc_elim.m	23 Feb 2006 09:36:50 -0000	1.107
+++ compiler/dead_proc_elim.m	24 Feb 2006 01:44:20 -0000
@@ -404,9 +404,7 @@
 
 examine_expr(disj(Goals), CurrProc, !Queue, !Needed) :-
     examine_goals(Goals, CurrProc, !Queue, !Needed).
-examine_expr(conj(Goals), CurrProc, !Queue, !Needed) :-
-    examine_goals(Goals, CurrProc, !Queue, !Needed).
-examine_expr(par_conj(Goals), CurrProc, !Queue, !Needed) :-
+examine_expr(conj(_ConjType, Goals), CurrProc, !Queue, !Needed) :-
     examine_goals(Goals, CurrProc, !Queue, !Needed).
 examine_expr(not(Goal), CurrProc, !Queue, !Needed) :-
     examine_goal(Goal, CurrProc, !Queue, !Needed).
@@ -580,7 +578,7 @@
             (pred(Id::in, PTable0::in, PTable::out) is det :-
                 map__lookup(ProcTable0, Id, ProcInfo0),
                 goal_info_init(GoalInfo),
-                Goal = conj([]) - GoalInfo,
+                Goal = true_goal_expr - GoalInfo,
                 proc_info_set_goal(Goal, ProcInfo0, ProcInfo),
                 map__det_update(PTable0, Id, ProcInfo, PTable)
             ),
@@ -843,9 +841,7 @@
 :- pred pre_modecheck_examine_goal(hlds_goal::in,
     dead_pred_info::in, dead_pred_info::out) is det.
 
-pre_modecheck_examine_goal(conj(Goals) - _, !DeadInfo) :-
-    list__foldl(pre_modecheck_examine_goal, Goals, !DeadInfo).
-pre_modecheck_examine_goal(par_conj(Goals) - _, !DeadInfo) :-
+pre_modecheck_examine_goal(conj(_ConjType, Goals) - _, !DeadInfo) :-
     list__foldl(pre_modecheck_examine_goal, Goals, !DeadInfo).
 pre_modecheck_examine_goal(disj(Goals) - _, !DeadInfo) :-
     list__foldl(pre_modecheck_examine_goal, Goals, !DeadInfo).
Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.43
diff -u -b -r1.43 deep_profiling.m
--- compiler/deep_profiling.m	23 Feb 2006 09:36:50 -0000	1.43
+++ compiler/deep_profiling.m	24 Feb 2006 03:46:12 -0000
@@ -240,12 +240,19 @@
             Continue = no
         )
     ;
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
         apply_tail_recursion_to_conj(Goals0, ApplyInfo, Goals,
             !FoundTailCall, Continue),
-        GoalExpr = conj(Goals),
+            GoalExpr = conj(ConjType, Goals),
         Goal = GoalExpr - GoalInfo0
     ;
+            ConjType = parallel_conj,
+            Goal = Goal0,
+            Continue = no
+        )
+    ;
         GoalExpr0 = disj(Goals0),
         apply_tail_recursion_to_disj(Goals0, ApplyInfo, Goals, !FoundTailCall),
         GoalExpr = disj(Goals),
@@ -268,10 +275,6 @@
         Goal = GoalExpr - GoalInfo0,
         Continue = no
     ;
-        GoalExpr0 = par_conj(_),
-        Goal = Goal0,
-        Continue = no
-    ;
         GoalExpr0 = scope(_, _),
         Goal = Goal0,
         Continue = no
@@ -374,7 +377,7 @@
     ;
         GoalExpr = unify(_, _, _, _, _)
     ;
-        GoalExpr = conj(Goals),
+        GoalExpr = conj(_ConjType, Goals),
         figure_out_rec_call_numbers_in_goal_list(Goals, !N, !TailCallSites)
     ;
         GoalExpr = disj(Goals),
@@ -388,9 +391,6 @@
         figure_out_rec_call_numbers(Then, !N, !TailCallSites),
         figure_out_rec_call_numbers(Else, !N, !TailCallSites)
     ;
-        GoalExpr = par_conj(Goals),
-        figure_out_rec_call_numbers_in_goal_list(Goals, !N, !TailCallSites)
-    ;
         GoalExpr = scope(_, Goal1),
         figure_out_rec_call_numbers(Goal1, !N, !TailCallSites)
     ;
@@ -590,7 +590,7 @@
     ),
 
     make_impure(GoalInfo0, GoalInfo),
-    Goal = conj([
+    Goal = conj(plain_conj, [
         BindProcStaticVarGoal,
         CallPortCode,
         TransformedGoal,
@@ -694,11 +694,11 @@
         NewNonlocals),
 
     make_impure(GoalInfo0, GoalInfo),
-    Goal = conj([
+    Goal = conj(plain_conj, [
         BindProcStaticVarGoal,
         CallPortCode,
         disj([
-            conj([
+            conj(plain_conj, [
                 TransformedGoal,
                 ExitPortCode
             ]) - ExitConjGoalInfo,
@@ -827,11 +827,11 @@
         ExitRedoNonLocals),
 
     make_impure(GoalInfo1, GoalInfo),
-    Goal = conj([
+    Goal = conj(plain_conj, [
         BindProcStaticVarGoal,
         CallPortCode,
         disj([
-            conj([
+            conj(plain_conj, [
                 TransformedGoal,
                 disj([
                     ExitPortCode,
@@ -898,13 +898,8 @@
 :- pred transform_goal(goal_path::in, hlds_goal::in, hlds_goal::out, bool::out,
     deep_info::in, deep_info::out) is det.
 
-transform_goal(Path, conj(Goals0) - GoalInfo0, conj(Goals) - GoalInfo,
-        AddedImpurity, !DeepInfo) :-
-    transform_conj(0, Path, Goals0, Goals, AddedImpurity, !DeepInfo),
-    add_impurity_if_needed(AddedImpurity, GoalInfo0, GoalInfo).
-
-transform_goal(Path, par_conj(Goals0) - GoalInfo0,
-        par_conj(Goals) - GoalInfo, AddedImpurity, !DeepInfo) :-
+transform_goal(Path, conj(ConjType, Goals0) - GoalInfo0,
+        conj(ConjType, Goals) - GoalInfo, AddedImpurity, !DeepInfo) :-
     transform_conj(0, Path, Goals0, Goals, AddedImpurity, !DeepInfo),
     add_impurity_if_needed(AddedImpurity, GoalInfo0, GoalInfo).
 
@@ -1160,7 +1155,7 @@
                 [SiteNumVar, TypeClassInfoVar, MethodNumVar],
                 [], PrepareCallGoal),
             PrepareCallGoal = _ - PrepareCallGoalInfo,
-            PrepareGoal = conj([
+            PrepareGoal = conj(plain_conj, [
                 MethodNumVarGoal,
                 PrepareCallGoal
             ]) - PrepareCallGoalInfo,
@@ -1217,7 +1212,7 @@
                 [SiteNumVarGoal, PrepareGoal, Goal2],
                 ExitGoals
             ], Goals),
-            Goal = conj(Goals) - GoalInfo
+            Goal = conj(plain_conj, Goals) - GoalInfo
         ;
 
             ExtraVars = list_to_set([MiddleCSD | SaveRestoreVars]),
@@ -1235,21 +1230,20 @@
             list__condense([
                 CallGoals,
                 [disj([
-                    conj([
+                    conj(plain_conj, [
                         SiteNumVarGoal,
                         PrepareGoal,
                         Goal2 |
                         ExitGoals
                     ]) - WrappedGoalGoalInfo,
-                    conj(
-                        FailGoalsAndFail
-                    ) - ReturnFailsGoalInfo
+                    conj(plain_conj, FailGoalsAndFail) - ReturnFailsGoalInfo
                 ]) - WrappedGoalGoalInfo]
             ], Goals),
-            Goal = conj(Goals) - GoalInfo
+            Goal = conj(plain_conj, Goals) - GoalInfo
         )
     ;
-        Goal = conj([SiteNumVarGoal, PrepareGoal, Goal2]) - GoalInfo
+        Goal = conj(plain_conj, [SiteNumVarGoal, PrepareGoal, Goal2])
+            - GoalInfo
     ).
 
 :- pred transform_higher_order_call(globals::in, code_model::in,
@@ -1324,21 +1318,21 @@
     make_impure(GoalInfo0, GoalInfo),
     (
         CodeModel = model_det,
-        Goal = conj([
+        Goal = conj(plain_conj, [
             SaveStuff,
             Goal0,
             RestoreStuff
         ]) - GoalInfo
     ;
         CodeModel = model_semi,
-        Goal = conj([
+        Goal = conj(plain_conj, [
             SaveStuff,
             disj([
-                conj([
+                conj(plain_conj, [
                     Goal0,
                     RestoreStuff
                 ]) - ExtGoalInfo,
-                conj([
+                conj(plain_conj, [
                     RestoreStuff,
                     FailGoal
                 ]) - RestoreFailGoalInfo
@@ -1346,20 +1340,20 @@
         ]) - GoalInfo
     ;
         CodeModel = model_non,
-        Goal = conj([
+        Goal = conj(plain_conj, [
             SaveStuff,
             disj([
-                conj([
+                conj(plain_conj, [
                     Goal0,
                     disj([
                         RestoreStuff,
-                        conj([
+                        conj(plain_conj, [
                             ReZeroStuff,
                             FailGoal
                         ]) - RezeroFailGoalInfo
                     ]) - NoBindExtGoalInfo
                 ]) - ExtGoalInfo,
-                conj([
+                conj(plain_conj, [
                     RestoreStuff,
                     FailGoal
                 ]) - RestoreFailGoalInfo
@@ -1390,7 +1384,7 @@
     CallSite = callback(FileName, LineNumber, GoalPath),
 
     make_impure(GoalInfo0, GoalInfo),
-    Goal = conj([SiteNumVarGoal, PrepareGoal, Goal0]) - GoalInfo,
+    Goal = conj(plain_conj, [SiteNumVarGoal, PrepareGoal, Goal0]) - GoalInfo,
     !:DeepInfo = !.DeepInfo ^ site_num_counter := SiteNumCounter,
     !:DeepInfo = !.DeepInfo ^ vars := VarSet,
     !:DeepInfo = !.DeepInfo ^ var_types := VarTypes,
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.58
diff -u -b -r1.58 deforest.m
--- compiler/deforest.m	16 Feb 2006 05:48:29 -0000	1.58
+++ compiler/deforest.m	24 Feb 2006 02:31:23 -0000
@@ -275,7 +275,10 @@
 :- pred deforest_goal(hlds_goal::in, hlds_goal::out,
     pd_info::in, pd_info::out, io::di, io::uo) is det.
 
-deforest_goal(conj(!.Goals) - Info, conj(!:Goals) - Info, !PDInfo, !IO) :-
+deforest_goal(conj(ConjType, !.Goals) - Info, conj(ConjType, !:Goals) - Info,
+        !PDInfo, !IO) :-
+    (
+        ConjType = plain_conj,
     pd_info_get_instmap(!.PDInfo, InstMap0),
     partially_evaluate_conj_goals(!.Goals, [], !:Goals, !PDInfo, !IO),
     pd_info_set_instmap(InstMap0, !PDInfo),
@@ -289,7 +292,8 @@
     ;
         Deforestation = no
     ),
-    globals__io_lookup_bool_option(constraint_propagation, Constraints, !IO),
+        globals__io_lookup_bool_option(constraint_propagation, Constraints,
+            !IO),
     pd_info_set_instmap(InstMap0, !PDInfo),
     (
         Constraints = yes,
@@ -298,10 +302,11 @@
     ;
         Constraints = no
     ),
-    pd_info_set_instmap(InstMap0, !PDInfo).
-
+        pd_info_set_instmap(InstMap0, !PDInfo)
+    ;
+        ConjType = parallel_conj
     % XXX cannot deforest across parallel_conjunctions!
-deforest_goal(par_conj(Goals) - Info, par_conj(Goals) - Info, !PDInfo, !IO).
+    ).
 
 deforest_goal(disj(Goals0) - Info, disj(Goals) - Info, !PDInfo, !IO) :-
     deforest_disj(Goals0, Goals, !PDInfo, !IO).
@@ -386,7 +391,7 @@
         !PDInfo, !IO) :-
     deforest_goal(Goal0, Goal1, !PDInfo, !IO),
     pd_info_update_goal(Goal1, !PDInfo),
-    ( Goal1 = conj(Goals1) - _ ->
+    ( Goal1 = conj(plain_conj, Goals1) - _ ->
         list__reverse(Goals1, RevGoals1),
         list__append(RevGoals1, RevGoals0, RevGoals2)
     ;
@@ -781,8 +786,8 @@
     maybe(hlds_goal)::in, bool::out,
     pd_info::in, pd_info::out, io::di, io::uo) is det.
 
-can_optimize_conj(EarlierGoal, BetweenGoals, MaybeLaterGoal,
-        ShouldTry, !PDInfo, !IO) :-
+can_optimize_conj(EarlierGoal, BetweenGoals, MaybeLaterGoal, ShouldTry,
+        !PDInfo, !IO) :-
     pd_info_get_pred_info(!.PDInfo, PredInfo),
     globals__io_lookup_option(deforestation_depth_limit, DepthLimitOpt, !IO),
     pd_info_get_depth(!.PDInfo, Depth0),
@@ -936,8 +941,8 @@
 
 call_call_2(ConjNonLocals, EarlierGoal, BetweenGoals,
         MaybeLaterGoal, MaybeGoal, !PDInfo, !IO) :-
-    create_conj(EarlierGoal, BetweenGoals,
-        MaybeLaterGoal, ConjNonLocals, FoldGoal),
+    create_conj(EarlierGoal, BetweenGoals, MaybeLaterGoal, ConjNonLocals,
+        FoldGoal),
 
     pd_info__search_version(!.PDInfo, FoldGoal, MaybeVersion, !IO),
     pd_info_get_parent_versions(!.PDInfo, Parents),
@@ -1033,8 +1038,8 @@
             % variables in BetweenGoals is less than
             % --deforestation-vars-threshold, go ahead and optimize.
 
-            module_info_pred_proc_info(ModuleInfo0,
-                PredId1, ProcId1, _, CalledProcInfo1),
+            module_info_pred_proc_info(ModuleInfo0, PredId1, ProcId1, _,
+                CalledProcInfo1),
             proc_info_goal(CalledProcInfo1, CalledGoal1),
             goal_util__goal_vars(CalledGoal1, GoalVars1),
             set__to_sorted_list(GoalVars1, GoalVarsList1),
@@ -1055,10 +1060,10 @@
         pd_info_get_proc_info(!.PDInfo, ProcInfo0),
         pd_debug__message("unfolding first call\n", [], !IO),
 
-        unfold_call(no, no, PredId1, ProcId1, Args1,
-            EarlierGoal, UnfoldedCall, DidUnfold, !PDInfo, !IO),
-        create_conj(UnfoldedCall, BetweenGoals,
-            MaybeLaterGoal, NonLocals, DeforestGoal0),
+        unfold_call(no, no, PredId1, ProcId1, Args1, EarlierGoal, UnfoldedCall,
+            DidUnfold, !PDInfo, !IO),
+        create_conj(UnfoldedCall, BetweenGoals, MaybeLaterGoal, NonLocals,
+            DeforestGoal0),
         set__to_sorted_list(NonLocals, NonLocalsList),
 
         (
@@ -1101,11 +1106,8 @@
             pd_info_get_module_info(!.PDInfo, ModuleInfo),
 
             predicate_name(ModuleInfo, PredId, PredName),
-            pd_debug__message("\nCreated predicate %s\n",
-                [s(PredName)], !IO),
-            (
-                MaybeLaterGoal = yes(call(PredId2, ProcId2, _, _, _, _) - _)
-            ->
+            pd_debug__message("\nCreated predicate %s\n", [s(PredName)], !IO),
+            ( MaybeLaterGoal = yes(call(PredId2, ProcId2, _, _, _, _) - _) ->
                 CalledPreds = [proc(PredId1, ProcId1), proc(PredId2, ProcId2)]
             ;
                 CalledPreds = [proc(PredId1, ProcId1)]
@@ -1252,7 +1254,7 @@
     EarlierGoal = _ - EarlierGoalInfo,
     goal_info_get_context(EarlierGoalInfo, EarlierContext),
     goal_info_set_context(EarlierContext, ConjInfo0, ConjInfo),
-    FoldGoal = conj(DeforestConj) - ConjInfo.
+    FoldGoal = conj(plain_conj, DeforestConj) - ConjInfo.
 
 %-----------------------------------------------------------------------------%
 
@@ -1698,7 +1700,7 @@
     goal_list_determinism(Goals, Detism),
     goal_list_purity(Goals, Purity),
     goal_info_init(NonLocals, Delta, Detism, Purity, GoalInfo),
-    Goal = conj(Goals) - GoalInfo.
+    Goal = conj(plain_conj, Goals) - GoalInfo.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: compiler/delay_construct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/delay_construct.m,v
retrieving revision 1.15
diff -u -b -r1.15 delay_construct.m
--- compiler/delay_construct.m	17 Nov 2005 15:57:07 -0000	1.15
+++ compiler/delay_construct.m	24 Feb 2006 02:31:29 -0000
@@ -94,38 +94,40 @@
 
 delay_construct_in_goal(GoalExpr0 - GoalInfo0, InstMap0, DelayInfo, Goal) :-
     (
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
         goal_info_get_determinism(GoalInfo0, Detism),
         determinism_components(Detism, CanFail, MaxSoln),
         (
-            % If the conjunction cannot fail, then its conjuncts cannot fail
-            % either, so we have no hope of pushing a construction past a
-            % failing goal.
-            %
-            % If the conjuntion contains goals that can succeed more than once,
-            % which is possible if MaxSoln is at_most_many or at_most_many_cc,
-            % then moving a construction to the right may increase the number
-            % of times the construction is executed. We are therefore careful
-            % to make sure delay_construct_in_conj doesn't move constructions
-            % across goals that succeed more than once.
+                % If the conjunction cannot fail, then its conjuncts cannot
+                % fail either, so we have no hope of pushing a construction
+                % past a failing goal.
             %
-            % If the conjunction cannot succeed, i.e. MaxSoln is at_most_zero,
-            % there is no point in trying to speed it up.
+                % If the conjuntion contains goals that can succeed more than
+                % once, which is possible if MaxSoln is at_most_many or
+                % at_most_many_cc, then moving a construction to the right
+                % may increase the number of times the construction is
+                % executed. We are therefore careful to make sure
+                % delay_construct_in_conj doesn't move constructions
+                % across goals that succeed more than once. If the conjunction
+                % cannot succeed, i.e. MaxSoln is at_most_zero, there is no
+                % point in trying to speed it up.
 
             CanFail = can_fail,
             MaxSoln \= at_most_zero
         ->
-            delay_construct_in_conj(Goals0, InstMap0, DelayInfo, set__init, [],
-                Goals1)
+                delay_construct_in_conj(Goals0, InstMap0, DelayInfo, set__init,
+                    [], Goals1)
         ;
             Goals1 = Goals0
+            )
+        ;
+            ConjType = parallel_conj,
+            Goals1 = Goals0
         ),
         delay_construct_in_goals(Goals1, InstMap0, DelayInfo, Goals),
-        Goal = conj(Goals) - GoalInfo0
-    ;
-        GoalExpr0 = par_conj(Goals0),
-        delay_construct_in_goals(Goals0, InstMap0, DelayInfo, Goals),
-        Goal = par_conj(Goals) - GoalInfo0
+        Goal = conj(ConjType, Goals) - GoalInfo0
     ;
         GoalExpr0 = disj(Goals0),
         delay_construct_in_goals(Goals0, InstMap0, DelayInfo, Goals),
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.82
diff -u -b -r1.82 dependency_graph.m
--- compiler/dependency_graph.m	23 Feb 2006 09:36:50 -0000	1.82
+++ compiler/dependency_graph.m	24 Feb 2006 01:46:15 -0000
@@ -390,10 +390,7 @@
     relation_key::in, dependency_graph(T)::in, dependency_graph(T)::out) is det
     <= dependency_node(T).
 
-dependency_graph__add_arcs_in_goal_2(conj(Goals), Caller, !DepGraph) :-
-    dependency_graph__add_arcs_in_list(Goals, Caller, !DepGraph).
-
-dependency_graph__add_arcs_in_goal_2(par_conj(Goals), Caller, !DepGraph) :-
+dependency_graph__add_arcs_in_goal_2(conj(_, Goals), Caller, !DepGraph) :-
     dependency_graph__add_arcs_in_list(Goals, Caller, !DepGraph).
 
 dependency_graph__add_arcs_in_goal_2(disj(Goals), Caller, !DepGraph) :-
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.186
diff -u -b -r1.186 det_analysis.m
--- compiler/det_analysis.m	23 Feb 2006 09:36:50 -0000	1.186
+++ compiler/det_analysis.m	24 Feb 2006 02:50:05 -0000
@@ -377,7 +377,7 @@
             % relevant equality theory, we want to prune away all but one
             % of those solutions.
 
-            ScopeReason = promise_equivalent_solutions(_)
+            ScopeReason = promise_solutions(_, _)
         )
     ->
         Prune = yes
@@ -445,7 +445,7 @@
         % nondet and multidet goals. If this happens, the conjunction is put
         % inside a scope goal to appease the code generator.
 
-        Goal1 = conj(ConjGoals),
+        Goal1 = conj(plain_conj, ConjGoals),
         Solns = at_most_zero,
         some [ConjGoalInfo] (
             list__member(_ - ConjGoalInfo, ConjGoals),
@@ -493,19 +493,21 @@
 det_infer_goal_2(GoalExpr0, GoalExpr, GoalInfo, InstMap0, SolnContext,
         RightFailingContexts, DetInfo, Detism, GoalFailingContexts, !:Msgs) :-
     (
-        GoalExpr0 = conj(Goals0),
-        % The determinism of a conjunction is the worst case of the elements
-        % of that conjuction.
+        GoalExpr0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
+            % The determinism of a conjunction is the worst case of the
+            % determinism of the goals of that conjuction.
         det_infer_conj(Goals0, Goals, InstMap0, SolnContext,
             RightFailingContexts, DetInfo, Detism, [], GoalFailingContexts,
-            !:Msgs),
-        GoalExpr = conj(Goals)
+                !:Msgs)
     ;
-        GoalExpr0 = par_conj(Goals0),
+            ConjType = parallel_conj,
         det_infer_par_conj(Goals0, Goals, GoalInfo, InstMap0, SolnContext,
             RightFailingContexts, DetInfo, Detism, GoalFailingContexts,
-            !:Msgs),
-        GoalExpr = par_conj(Goals)
+                !:Msgs)
+        ),
+        GoalExpr = conj(ConjType, Goals)
     ;
         GoalExpr0 = disj(Goals0),
         det_infer_disj(Goals0, Goals, GoalInfo, InstMap0, SolnContext,
@@ -1167,7 +1169,7 @@
     % Existential quantification may require a cut to throw away solutions,
     % but we cannot rely on explicit quantification to detect this.
     % Therefore cuts are handled in det_infer_goal.
-    ( Reason = promise_equivalent_solutions(Vars) ->
+    ( Reason = promise_solutions(Vars, Kind) ->
         SolnContextToUse = first_soln,
         goal_info_get_instmap_delta(GoalInfo, InstmapDelta),
         instmap_delta_changed_vars(InstmapDelta, ChangedVars),
@@ -1180,13 +1182,12 @@
         proc_info_varset(ProcInfo, VarSet),
 
         % Which vars were bound inside the scope but not listed
-        % in the promise_equivalent_solutions?
+        % in the promise_{equivalent,same}_solutions?
         set__difference(BoundVars, set__list_to_set(Vars), BugVars),
         ( set__empty(BugVars) ->
             ScopeMsgs1 = []
         ;
-            ScopeMsg1 = promise_equivalent_solutions_missing_vars(VarSet,
-                BugVars),
+            ScopeMsg1 = promise_solutions_missing_vars(Kind, VarSet, BugVars),
             ContextScopeMsg1 = context_det_msg(Context, ScopeMsg1),
             ScopeMsgs1 = [ContextScopeMsg1]
         ),
@@ -1196,8 +1197,7 @@
         ( set__empty(ExtraVars) ->
             ScopeMsgs2 = []
         ;
-            ScopeMsg2 = promise_equivalent_solutions_extra_vars(VarSet,
-                ExtraVars),
+            ScopeMsg2 = promise_solutions_extra_vars(Kind, VarSet, ExtraVars),
             ContextScopeMsg2 = context_det_msg(Context, ScopeMsg2),
             ScopeMsgs2 = [ContextScopeMsg2]
         ),
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.111
diff -u -b -r1.111 det_report.m
--- compiler/det_report.m	27 Jan 2006 05:52:03 -0000	1.111
+++ compiler/det_report.m	24 Feb 2006 02:22:20 -0000
@@ -82,9 +82,9 @@
     ;       export_model_non_proc(pred_id, proc_id, determinism)
             % Procedure with multi or nondet detism exported
             % via :- pragma export ...
-    ;       promise_equivalent_solutions_missing_vars(prog_varset,
+    ;       promise_solutions_missing_vars(promise_solutions_kind, prog_varset,
                 set(prog_var))
-    ;       promise_equivalent_solutions_extra_vars(prog_varset,
+    ;       promise_solutions_extra_vars(promise_solutions_kind, prog_varset,
                 set(prog_var)).
 
 :- type seen_call_id
@@ -541,12 +541,8 @@
     list(error_msg_spec)::in(known_error_msg_specs),
     list(error_msg_spec)::out(known_error_msg_specs)) is det.
 
-det_diagnose_goal_2(conj(Goals), _GoalInfo, Desired, _Actual, Context, DetInfo,
-        Diagnosed, !Specs) :-
-    det_diagnose_conj(Goals, Desired, Context, DetInfo, Diagnosed, !Specs).
-
-det_diagnose_goal_2(par_conj(Goals), _GoalInfo, Desired, _Actual,
-        Context, DetInfo, Diagnosed, !Specs) :-
+det_diagnose_goal_2(conj(_, Goals), _GoalInfo, Desired, _Actual, Context,
+        DetInfo, Diagnosed, !Specs) :-
     det_diagnose_conj(Goals, Desired, Context, DetInfo, Diagnosed, !Specs).
 
 det_diagnose_goal_2(disj(Goals), GoalInfo, Desired, Actual, SwitchContext,
@@ -1142,8 +1138,8 @@
 det_msg_get_type(has_io_state_but_not_det(_, _), det_error).
 det_msg_get_type(will_not_throw_with_erroneous(_, _), det_error).
 det_msg_get_type(export_model_non_proc(_, _, _), det_error).
-det_msg_get_type(promise_equivalent_solutions_missing_vars(_, _), det_error).
-det_msg_get_type(promise_equivalent_solutions_extra_vars(_, _), det_error).
+det_msg_get_type(promise_solutions_missing_vars(_, _, _), det_error).
+det_msg_get_type(promise_solutions_extra_vars(_, _, _), det_error).
 
 det_msg_is_any_mode_msg(multidet_disj(_), all_modes).
 det_msg_is_any_mode_msg(det_disj(_), all_modes).
@@ -1173,10 +1169,8 @@
 det_msg_is_any_mode_msg(has_io_state_but_not_det(_, _), any_mode).
 det_msg_is_any_mode_msg(will_not_throw_with_erroneous(_, _), any_mode).
 det_msg_is_any_mode_msg(export_model_non_proc(_, _, _), any_mode).
-det_msg_is_any_mode_msg(promise_equivalent_solutions_missing_vars(_, _),
-    any_mode).
-det_msg_is_any_mode_msg(promise_equivalent_solutions_extra_vars(_, _),
-    any_mode).
+det_msg_is_any_mode_msg(promise_solutions_missing_vars(_, _, _), any_mode).
+det_msg_is_any_mode_msg(promise_solutions_extra_vars(_, _, _), any_mode).
 
 :- pred det_report_msg(det_msg::in, prog_context::in, module_info::in,
     io::di, io::uo) is det.
@@ -1501,14 +1495,15 @@
         fixed(hlds_out.determinism_to_string(Detism) ++ ",")
         ],
     write_error_pieces(Context, 0, Pieces, !IO).
-det_report_msg(promise_equivalent_solutions_missing_vars(VarSet, Vars),
-        Context, _, !IO) :-
+det_report_msg(promise_solutions_missing_vars(Kind, VarSet, Vars), Context, _,
+        !IO) :-
     VarNames = list.map(lookup_var_name_in_varset(VarSet),
         set.to_sorted_list(Vars)),
+    KindStr = promise_solutions_kind_str(Kind),
     (
         VarNames = [],
         unexpected(this_file, "det_report_msg: " ++
-            "promise_equivalent_solutions_missing_vars empty")
+            "promise_solutions_missing_vars empty")
     ;
         VarNames = [_],
         ListStr = "a variable that is not listed:"
@@ -1516,17 +1511,18 @@
         VarNames = [_, _ | _],
         ListStr = "some variables that are not listed:"
     ),
-    Pieces = [words("Error: the promise_equivalent_solutions goal binds "),
+    Pieces = [words("Error: the"), words(KindStr), words("goal binds"),
           words(ListStr)] ++ list_to_pieces(VarNames) ++ [suffix(".")],
     error_util.write_error_pieces(Context, 0, Pieces, !IO).
-det_report_msg(promise_equivalent_solutions_extra_vars(VarSet, Vars), Context,
-        _, !IO) :-
+det_report_msg(promise_solutions_extra_vars(Kind, VarSet, Vars), Context, _,
+        !IO) :-
     VarNames = list.map(lookup_var_name_in_varset(VarSet),
         set.to_sorted_list(Vars)),
+    KindStr = promise_solutions_kind_str(Kind),
     (
         VarNames = [],
         unexpected(this_file, "det_report_msg: " ++
-            "promise_equivalent_solutions_extra_vars empty")
+            "promise_solutions_extra_vars empty")
     ;
         VarNames = [_],
         ListStr = "an extra variable:"
@@ -1534,9 +1530,16 @@
         VarNames = [_, _ | _],
         ListStr = "some extra variables:"
     ),
-    Pieces = [words("Error: the promise_equivalent_solutions goal lists "),
+    Pieces = [words("Error: the"), words(KindStr), words("goal lists"),
           words(ListStr)] ++ list_to_pieces(VarNames) ++ [suffix(".")],
     error_util.write_error_pieces(Context, 0, Pieces, !IO).
+
+:- func promise_solutions_kind_str(promise_solutions_kind) = string.
+
+promise_solutions_kind_str(equivalent_solutions)
+    = "promise_equivalent_solutions".
+promise_solutions_kind_str(same_solutions)
+    = "promise_same_solutions".
 
 :- func lookup_var_name_in_varset(prog_varset, prog_var) = string.
 
Index: compiler/equiv_type_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type_hlds.m,v
retrieving revision 1.26
diff -u -b -r1.26 equiv_type_hlds.m
--- compiler/equiv_type_hlds.m	24 Feb 2006 01:41:45 -0000	1.26
+++ compiler/equiv_type_hlds.m	24 Feb 2006 01:44:22 -0000
@@ -657,16 +657,11 @@
     `with_type` replacer(hlds_goal_expr, replace_info)
     `with_inst` replacer.
 
-replace_in_goal_expr(EqvMap, Goal0 @ conj(Goals0), Goal, Changed, !Info) :-
-    replace_in_list(replace_in_goal(EqvMap), Goals0, Goals,
-        Changed, !Info),
-    ( Changed = yes, Goal = conj(Goals)
-    ; Changed = no, Goal = Goal0
-    ).
-replace_in_goal_expr(EqvMap, Goal0 @ par_conj(Goals0), Goal, Changed, !Info) :-
+replace_in_goal_expr(EqvMap, Goal0 @ conj(ConjType, Goals0), Goal, Changed,
+        !Info) :-
     replace_in_list(replace_in_goal(EqvMap), Goals0, Goals,
         Changed, !Info),
-    ( Changed = yes, Goal = par_conj(Goals)
+    ( Changed = yes, Goal = conj(ConjType, Goals)
     ; Changed = no, Goal = Goal0
     ).
 replace_in_goal_expr(EqvMap, Goal0 @ disj(Goals0), Goal, Changed, !Info) :-
@@ -785,7 +780,7 @@
         ( Goals = [Goal1 - _] ->
             Goal = Goal1
         ;
-            Goal = conj(Goals)
+            Goal = conj(plain_conj, Goals)
         ),
         !:Info = !.Info ^ recompute := yes
     ;
@@ -801,7 +796,7 @@
         Body = eqv_type(_)
     ->
         Changed = yes,
-        Goal = conj([]),
+        Goal = conj(plain_conj, []),
         !:Info = !.Info ^ recompute := yes
     ;
         Goal0 ^ unify_mode = LMode0 - RMode0,
Index: compiler/exception_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exception_analysis.m,v
retrieving revision 1.22
diff -u -b -r1.22 exception_analysis.m
--- compiler/exception_analysis.m	23 Feb 2006 09:36:51 -0000	1.22
+++ compiler/exception_analysis.m	24 Feb 2006 01:44:22 -0000
@@ -531,8 +531,7 @@
 check_goal_for_exceptions_2(SCC, VarTypes, Goal, _, !Result, !ModuleInfo,
         !IO) :-
     ( Goal = disj(Goals)
-    ; Goal = par_conj(Goals)
-    ; Goal = conj(Goals)
+    ; Goal = conj(_, Goals)
     ),
     check_goals_for_exceptions(SCC, VarTypes, Goals, !Result, !ModuleInfo,
         !IO).
Index: compiler/follow_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.79
diff -u -b -r1.79 follow_code.m
--- compiler/follow_code.m	28 Nov 2005 04:11:41 -0000	1.79
+++ compiler/follow_code.m	24 Feb 2006 02:29:50 -0000
@@ -116,14 +116,17 @@
 :- pred move_follow_code_in_goal_2(hlds_goal_expr::in, hlds_goal_expr::out,
     pair(bool)::in, bool::in, bool::out) is det.
 
-move_follow_code_in_goal_2(conj(Goals0), conj(Goals), Flags, !R) :-
-    move_follow_code_in_conj(Goals0, Goals, Flags, !R).
-move_follow_code_in_goal_2(par_conj(Goals0), par_conj(Goals), Flags, !R) :-
-    % move_follow_code_in_disj treats its list of goals as independent goals,
-    % so we can use it to process the independent parallel conjuncts.
-    move_follow_code_in_disj(Goals0, Goals, Flags, !R).
+move_follow_code_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
+        Flags, !R) :-
+    (
+        ConjType = plain_conj,
+        move_follow_code_in_conj(Goals0, Goals, Flags, !R)
+    ;
+        ConjType = parallel_conj,
+        move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R)
+    ).
 move_follow_code_in_goal_2(disj(Goals0), disj(Goals), Flags, !R) :-
-    move_follow_code_in_disj(Goals0, Goals, Flags, !R).
+    move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R).
 move_follow_code_in_goal_2(not(Goal0), not(Goal), Flags, !R) :-
     move_follow_code_in_goal(Goal0, Goal, Flags, !R).
 move_follow_code_in_goal_2(switch(Var, Det, Cases0),
@@ -147,16 +150,17 @@
 
 %-----------------------------------------------------------------------------%
 
-    % move_follow_code_in_disj is used both for disjunction and
+    % move_follow_code_in_independent_goals is used both for disjunction and
     % parallel conjunction.
     %
-:- pred move_follow_code_in_disj(list(hlds_goal)::in, list(hlds_goal)::out,
-    pair(bool)::in, bool::in, bool::out) is det.
+:- pred move_follow_code_in_independent_goals(list(hlds_goal)::in,
+    list(hlds_goal)::out, pair(bool)::in, bool::in, bool::out) is det.
 
-move_follow_code_in_disj([], [], _, !R).
-move_follow_code_in_disj([Goal0|Goals0], [Goal|Goals], Flags, !R) :-
+move_follow_code_in_independent_goals([], [], _, !R).
+move_follow_code_in_independent_goals([Goal0|Goals0], [Goal|Goals], Flags,
+        !R) :-
     move_follow_code_in_goal(Goal0, Goal, Flags, !R),
-    move_follow_code_in_disj(Goals0, Goals, Flags, !R).
+    move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R).
 
 %-----------------------------------------------------------------------------%
 
@@ -234,8 +238,8 @@
         Goal = disj(Goals)
     ;
         Goal0 = if_then_else(Vars, Cond, Then0, Else0),
-        follow_code__conjoin_goal_and_goal_list(Then0, FollowGoals, Then),
-        follow_code__conjoin_goal_and_goal_list(Else0, FollowGoals, Else),
+        follow_code_conjoin_goal_and_goal_list(Then0, FollowGoals, Then),
+        follow_code_conjoin_goal_and_goal_list(Else0, FollowGoals, Else),
         Goal = if_then_else(Vars, Cond, Then, Else)
     ).
 
@@ -247,7 +251,7 @@
 move_follow_code_move_goals_cases([], _FollowGoals, []).
 move_follow_code_move_goals_cases([Case0|Cases0], FollowGoals, [Case|Cases]) :-
     Case0 = case(Cons, Goal0),
-    follow_code__conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
+    follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
     Case = case(Cons, Goal),
     move_follow_code_move_goals_cases(Cases0, FollowGoals, Cases).
 
@@ -258,7 +262,7 @@
 
 move_follow_code_move_goals_disj([], _FollowGoals, []).
 move_follow_code_move_goals_disj([Goal0|Goals0], FollowGoals, [Goal|Goals]) :-
-    follow_code__conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
+    follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
     move_follow_code_move_goals_disj(Goals0, FollowGoals, Goals).
 
 %-----------------------------------------------------------------------------%
@@ -267,10 +271,10 @@
     % blank goal_info), checking that the determinism of the goal is not
     % changed.
     %
-:- pred follow_code__conjoin_goal_and_goal_list(hlds_goal::in,
+:- pred follow_code_conjoin_goal_and_goal_list(hlds_goal::in,
     list(hlds_goal)::in, hlds_goal::out) is semidet.
 
-follow_code__conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal) :-
+follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal) :-
     Goal0 = GoalExpr0 - GoalInfo0,
     goal_info_get_determinism(GoalInfo0, Detism0),
     determinism_components(Detism0, _CanFail0, MaxSolns0),
@@ -278,11 +282,11 @@
         Goal = Goal0
     ;
         check_follow_code_detism(FollowGoals, Detism0),
-        ( GoalExpr0 = conj(GoalList0) ->
+        ( GoalExpr0 = conj(plain_conj, GoalList0) ->
             list__append(GoalList0, FollowGoals, GoalList),
-            GoalExpr = conj(GoalList)
+            GoalExpr = conj(plain_conj, GoalList)
         ;
-            GoalExpr = conj([Goal0 | FollowGoals])
+            GoalExpr = conj(plain_conj, [Goal0 | FollowGoals])
         ),
         Goal = GoalExpr - GoalInfo0
     ).
Index: compiler/follow_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/follow_vars.m,v
retrieving revision 1.79
diff -u -b -r1.79 follow_vars.m
--- compiler/follow_vars.m	17 Nov 2005 15:57:12 -0000	1.79
+++ compiler/follow_vars.m	24 Feb 2006 02:29:56 -0000
@@ -113,28 +113,27 @@
     abs_follow_vars_map::in, abs_follow_vars_map::out,
     int::in, int::out) is det.
 
-find_follow_vars_in_goal_expr(conj(Goals0), conj(Goals), GoalInfo, GoalInfo,
-        VarTypes, ModuleInfo, !FollowVarsMap, !NextNonReserved) :-
+find_follow_vars_in_goal_expr(conj(ConjType, Goals0), conj(ConjType, Goals),
+        GoalInfo, GoalInfo, VarTypes, ModuleInfo, !FollowVarsMap,
+        !NextNonReserved) :-
+    (
+        ConjType = plain_conj,
     find_follow_vars_in_conj(Goals0, Goals, VarTypes, ModuleInfo,
-        no, !FollowVarsMap, !NextNonReserved).
-
-find_follow_vars_in_goal_expr(par_conj(Goals0), par_conj(Goals),
-        GoalInfo, GoalInfo, VarTypes, ModuleInfo,
-        !FollowVarsMap, !NextNonReserved) :-
-        % find_follow_vars_in_disj treats its list of goals as a
-        % series of independent goals, so we can use it to process
-        % independent parallel conjunction.
-    find_follow_vars_in_disj(Goals0, Goals, VarTypes, ModuleInfo,
-        !FollowVarsMap, !NextNonReserved).
+            no, !FollowVarsMap, !NextNonReserved)
+    ;
+        ConjType = parallel_conj,
+        find_follow_vars_in_independent_goals(Goals0, Goals, VarTypes,
+            ModuleInfo, !FollowVarsMap, !NextNonReserved)
+    ).
 
+find_follow_vars_in_goal_expr(disj(Goals0), disj(Goals), GoalInfo0, GoalInfo,
+        VarTypes, ModuleInfo, !FollowVarsMap, !NextNonReserved) :-
     % We record that at the end of each disjunct, live variables should
     % be in the locations given by the initial follow_vars, which reflects
     % the requirements of the code following the disjunction.
-    %
-find_follow_vars_in_goal_expr(disj(Goals0), disj(Goals), GoalInfo0, GoalInfo,
-        VarTypes, ModuleInfo, !FollowVarsMap, !NextNonReserved) :-
+
     goal_info_set_store_map(!.FollowVarsMap, GoalInfo0, GoalInfo),
-    find_follow_vars_in_disj(Goals0, Goals, VarTypes, ModuleInfo,
+    find_follow_vars_in_independent_goals(Goals0, Goals, VarTypes, ModuleInfo,
         !FollowVarsMap, !NextNonReserved).
 
 find_follow_vars_in_goal_expr(not(Goal0), not(Goal), GoalInfo, GoalInfo,
@@ -142,18 +141,24 @@
     find_follow_vars_in_goal(Goal0, Goal, VarTypes, ModuleInfo,
         !FollowVarsMap, !NextNonReserved).
 
+find_follow_vars_in_goal_expr(switch(Var, Det, Cases0),
+        switch(Var, Det, Cases), GoalInfo0, GoalInfo, VarTypes, ModuleInfo,
+        !FollowVarsMap, !NextNonReserved) :-
     % We record that at the end of each arm of the switch, live variables
     % should be in the locations given by the initial follow_vars, which
     % reflects the requirements of the code following the switch.
-    %
-find_follow_vars_in_goal_expr(switch(Var, Det, Cases0),
-        switch(Var, Det, Cases), GoalInfo0, GoalInfo,
-        VarTypes, ModuleInfo,
-        !FollowVarsMap, !NextNonReserved) :-
+
     goal_info_set_store_map(!.FollowVarsMap, GoalInfo0, GoalInfo),
     find_follow_vars_in_cases(Cases0, Cases, VarTypes, ModuleInfo,
         !FollowVarsMap, !NextNonReserved).
 
+find_follow_vars_in_goal_expr(
+        if_then_else(Vars, Cond0, Then0, Else0),
+        if_then_else(Vars, Cond, Then, Else),
+        GoalInfo0, GoalInfo, VarTypes, ModuleInfo,
+        FollowVarsMap0, FollowVarsMapCond,
+        NextNonReserved0, NextNonReservedCond) :-
+
     % Set the follow_vars field for the condition, the then-part and the
     % else-part, since in general they have requirements about where
     % variables should be.
@@ -170,13 +175,6 @@
     % live variables should be in the locations given by the initial
     % follow_vars, which reflects the requirements of the code
     % following the if-then-else.
-
-find_follow_vars_in_goal_expr(
-        if_then_else(Vars, Cond0, Then0, Else0),
-        if_then_else(Vars, Cond, Then, Else),
-        GoalInfo0, GoalInfo, VarTypes, ModuleInfo,
-        FollowVarsMap0, FollowVarsMapCond,
-        NextNonReserved0, NextNonReservedCond) :-
     find_follow_vars_in_goal(Then0, Then1, VarTypes, ModuleInfo,
         FollowVarsMap0, FollowVarsMapThen,
         NextNonReserved0, NextNonReservedThen),
@@ -321,16 +319,15 @@
 
 %-----------------------------------------------------------------------------%
 
-    % We attach a follow_vars to each arm of a switch, since inside
-    % each arm the preferred locations for variables will in general
-    % be different.
-
-    % For the time being, we return the follow_vars computed from
-    % the first arm as the preferred requirements of the switch as
-    % a whole. This is close to right, since the first disjunct will
-    % definitely be the first to be entered. However, the follow_vars
-    % computed for the disjunction as a whole can profitably mention
-    % variables that are not live in the first disjunct, but may be
+    % We attach a follow_vars to each arm of a switch, since inside each arm
+    % the preferred locations for variables will in general be different.
+
+    % For the time being, we return the follow_vars computed from the first arm
+    % as the preferred requirements of the compound goal (disjunction or
+    % parallel conjunction) as a whole. This is close to right, since the first
+    % disjunct will definitely be the first to be entered. However, the
+    % follow_vars computed for the disjunction as a whole can profitably
+    % mention variables that are not live in the first disjunct, but may be
     % needed in the second and later disjuncts. In general, we may
     % wish to take into account the requirements of all disjuncts
     % up to the first non-failing disjunct. (The requirements of
@@ -340,16 +337,16 @@
     % entered at all.)
     %
     % This code is used both for disjunction and parallel conjunction.
+    %
+:- pred find_follow_vars_in_independent_goals(list(hlds_goal)::in,
+    list(hlds_goal)::out, vartypes::in, module_info::in,
+    abs_follow_vars_map::in, abs_follow_vars_map::out, int::in, int::out)
+    is det.
 
-:- pred find_follow_vars_in_disj(list(hlds_goal)::in, list(hlds_goal)::out,
-    vartypes::in, module_info::in,
-    abs_follow_vars_map::in, abs_follow_vars_map::out,
-    int::in, int::out) is det.
-
-find_follow_vars_in_disj([], [], _, _ModuleInfo,
+find_follow_vars_in_independent_goals([], [], _, _ModuleInfo,
         FollowVarsMap,  FollowVarsMap,
         NextNonReserved, NextNonReserved).
-find_follow_vars_in_disj([Goal0 | Goals0], [Goal | Goals],
+find_follow_vars_in_independent_goals([Goal0 | Goals0], [Goal | Goals],
         VarTypes, ModuleInfo, FollowVarsMap0, FollowVarsMap,
         NextNonReserved0, NextNonReserved) :-
     find_follow_vars_in_goal(Goal0, Goal1, VarTypes, ModuleInfo,
@@ -357,7 +354,7 @@
         NextNonReserved0, NextNonReserved),
     FollowVars = abs_follow_vars(FollowVarsMap, NextNonReserved),
     goal_set_follow_vars(yes(FollowVars), Goal1, Goal),
-    find_follow_vars_in_disj(Goals0, Goals, VarTypes, ModuleInfo,
+    find_follow_vars_in_independent_goals(Goals0, Goals, VarTypes, ModuleInfo,
         FollowVarsMap0, _FollowVarsMap,
         NextNonReserved0, _NextNonReserved).
 
Index: compiler/format_call.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/format_call.m,v
retrieving revision 1.1
diff -u -b -r1.1 format_call.m
--- compiler/format_call.m	27 Jan 2006 05:52:04 -0000	1.1
+++ compiler/format_call.m	17 Feb 2006 02:51:34 -0000
@@ -362,11 +362,7 @@
         !ConjMaps, !PredMap, !RelevantVars, ModuleInfo),
     Goal = GoalExpr - GoalInfo,
     (
-        GoalExpr = conj(Conjuncts),
-        traverse_conj(Conjuncts, CurId, !FormatCallSites, !Counter,
-            !ConjMaps, !PredMap, !RelevantVars, ModuleInfo)
-    ;
-        GoalExpr = par_conj(Conjuncts),
+        GoalExpr = conj(_, Conjuncts),
         traverse_conj(Conjuncts, CurId, !FormatCallSites, !Counter,
             !ConjMaps, !PredMap, !RelevantVars, ModuleInfo)
     ;
Index: compiler/goal_form.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_form.m,v
retrieving revision 1.26
diff -u -b -r1.26 goal_form.m
--- compiler/goal_form.m	21 Feb 2006 12:20:25 -0000	1.26
+++ compiler/goal_form.m	24 Feb 2006 02:25:44 -0000
@@ -21,6 +21,7 @@
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
 
+:- import_module bool.
 :- import_module io.
 
 %-----------------------------------------------------------------------------%
@@ -113,11 +114,10 @@
     %
 :- pred goal_can_loop_or_throw(hlds_goal::in) is semidet.
 
-    % goal_is_flat(Goal) is true if Goal does not contain any
-    % branched structures (ie if-then-else or disjunctions or
-    % switches.)
+    % goal_is_flat(Goal) return `yes' if Goal does not contain any
+    % branched structures (ie if-then-else or disjunctions or switches.)
     %
-:- pred goal_is_flat(hlds_goal::in) is semidet.
+:- func goal_is_flat(hlds_goal) = bool.
 
     % Determine whether a goal might allocate some heap space, i.e.
     % whether it contains any construction unifications or predicate
@@ -204,12 +204,10 @@
 
 goal_can_throw_2(Goal, _GoalInfo, Result, !ModuleInfo, !IO) :-
     (
-        Goal = conj(Goals)
+        Goal = conj(_, Goals)
     ;
         Goal = disj(Goals)
     ;
-        Goal = par_conj(Goals)
-    ;
         Goal = if_then_else(_, IfGoal, ThenGoal, ElseGoal),
         Goals = [IfGoal, ThenGoal, ElseGoal]
     ),
@@ -341,10 +339,12 @@
     Goal = GoalExpr - _,
     goal_cannot_loop_expr(MaybeModuleInfo, GoalExpr).
 
+    % XXX This predicate should be replaced by a function returning a bool.
+    %
 :- pred goal_cannot_loop_expr(maybe(module_info)::in, hlds_goal_expr::in)
     is semidet.
 
-goal_cannot_loop_expr(MaybeModuleInfo, conj(Goals)) :-
+goal_cannot_loop_expr(MaybeModuleInfo, conj(plain_conj, Goals)) :-
     list__member(Goal, Goals) =>
         goal_cannot_loop_aux(MaybeModuleInfo, Goal).
 goal_cannot_loop_expr(MaybeModuleInfo, disj(Goals)) :-
@@ -409,10 +409,12 @@
     not Determinism = erroneous,
     goal_cannot_throw_expr(MaybeModuleInfo, GoalExpr).
 
+    % XXX This predicate should be replaced by a function returning a bool.
+    %
 :- pred goal_cannot_throw_expr(maybe(module_info)::in, hlds_goal_expr::in)
     is semidet.
 
-goal_cannot_throw_expr(MaybeModuleInfo, conj(Goals)) :-
+goal_cannot_throw_expr(MaybeModuleInfo, conj(plain_conj, Goals)) :-
     list.member(Goal, Goals) =>
         goal_cannot_throw_aux(MaybeModuleInfo, Goal).
 goal_cannot_throw_expr(MaybeModuleInfo, disj(Goals)) :-
@@ -459,28 +461,38 @@
 
 %-----------------------------------------------------------------------------%
 
-goal_is_flat(Goal - _GoalInfo) :-
-    goal_is_flat_expr(Goal).
+goal_is_flat(Goal - _GoalInfo) = goal_is_flat_expr(Goal).
 
-:- pred goal_is_flat_expr(hlds_goal_expr::in) is semidet.
+:- func goal_is_flat_expr(hlds_goal_expr) = bool.
 
-goal_is_flat_expr(conj(Goals)) :-
-    goal_is_flat_list(Goals).
-goal_is_flat_expr(not(Goal)) :-
-    goal_is_flat(Goal).
-goal_is_flat_expr(scope(_, Goal)) :-
-    goal_is_flat(Goal).
-goal_is_flat_expr(generic_call(_, _, _, _)).
-goal_is_flat_expr(call(_, _, _, _, _, _)).
-goal_is_flat_expr(unify(_, _, _, _, _)).
-goal_is_flat_expr(foreign_proc(_, _, _, _, _, _)).
-
-:- pred goal_is_flat_list(list(hlds_goal)::in) is semidet.
-
-goal_is_flat_list([]).
-goal_is_flat_list([Goal | Goals]) :-
-    goal_is_flat(Goal),
-    goal_is_flat_list(Goals).
+goal_is_flat_expr(generic_call(_, _, _, _)) = yes.
+goal_is_flat_expr(call(_, _, _, _, _, _)) = yes.
+goal_is_flat_expr(unify(_, _, _, _, _)) = yes.
+goal_is_flat_expr(foreign_proc(_, _, _, _, _, _)) = yes.
+goal_is_flat_expr(conj(ConjType, Goals)) = IsFlat :-
+    (
+        ConjType = parallel_conj,
+        IsFlat = no
+    ;
+        ConjType = plain_conj,
+        IsFlat = goal_is_flat_list(Goals)
+    ).
+goal_is_flat_expr(disj(_)) = no.
+goal_is_flat_expr(switch(_, _, _)) = no.
+goal_is_flat_expr(if_then_else(_, _, _, _)) = no.
+goal_is_flat_expr(not(Goal)) = goal_is_flat(Goal).
+goal_is_flat_expr(scope(_, Goal)) = goal_is_flat(Goal).
+goal_is_flat_expr(shorthand(_)) = no.
+
+:- func goal_is_flat_list(list(hlds_goal)) = bool.
+
+goal_is_flat_list([]) = yes.
+goal_is_flat_list([Goal | Goals]) = IsFlat :-
+    ( goal_is_flat(Goal) = yes ->
+        IsFlat = goal_is_flat_list(Goals)
+    ;
+        IsFlat = no
+    ).
 
 %-----------------------------------------------------------------------------%
 
@@ -523,9 +535,14 @@
     goal_may_allocate_heap(Goal, May).
 goal_may_allocate_heap_2(not(Goal), May) :-
     goal_may_allocate_heap(Goal, May).
-goal_may_allocate_heap_2(conj(Goals), May) :-
-    goal_list_may_allocate_heap(Goals, May).
-goal_may_allocate_heap_2(par_conj(_), yes).
+goal_may_allocate_heap_2(conj(ConjType, Goals), May) :-
+    (
+        ConjType = parallel_conj,
+        May = yes
+    ;
+        ConjType = plain_conj,
+        goal_list_may_allocate_heap(Goals, May)
+    ).
 goal_may_allocate_heap_2(disj(Goals), May) :-
     goal_list_may_allocate_heap(Goals, May).
 goal_may_allocate_heap_2(switch(_Var, _Det, Cases), May) :-
@@ -582,7 +599,8 @@
     Unify \= complicated_unify(_, _, _).
 cannot_stack_flush_2(call(_, _, _, BuiltinState, _, _)) :-
     BuiltinState = inline_builtin.
-cannot_stack_flush_2(conj(Goals)) :-
+cannot_stack_flush_2(conj(ConjType, Goals)) :-
+    ConjType = plain_conj,
     cannot_stack_flush_goals(Goals).
 cannot_stack_flush_2(switch(_, _, Cases)) :-
     cannot_stack_flush_cases(Cases).
@@ -617,7 +635,8 @@
 
 :- pred cannot_fail_before_stack_flush_2(hlds_goal_expr::in) is semidet.
 
-cannot_fail_before_stack_flush_2(conj(Goals)) :-
+cannot_fail_before_stack_flush_2(conj(ConjType, Goals)) :-
+    ConjType = plain_conj,
     cannot_fail_before_stack_flush_conj(Goals).
 
 :- pred cannot_fail_before_stack_flush_conj(list(hlds_goal)::in) is semidet.
@@ -668,9 +687,7 @@
     ;
         Count = 0
     ).
-count_recursive_calls_2(conj(Goals), PredId, ProcId, Min, Max) :-
-    count_recursive_calls_conj(Goals, PredId, ProcId, 0, 0, Min, Max).
-count_recursive_calls_2(par_conj(Goals), PredId, ProcId, Min, Max) :-
+count_recursive_calls_2(conj(_, Goals), PredId, ProcId, Min, Max) :-
     count_recursive_calls_conj(Goals, PredId, ProcId, 0, 0, Min, Max).
 count_recursive_calls_2(disj(Goals), PredId, ProcId, Min, Max) :-
     count_recursive_calls_disj(Goals, PredId, ProcId, Min, Max).
Index: compiler/goal_path.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_path.m,v
retrieving revision 1.30
diff -u -b -r1.30 goal_path.m
--- compiler/goal_path.m	23 Feb 2006 09:36:51 -0000	1.30
+++ compiler/goal_path.m	24 Feb 2006 01:44:23 -0000
@@ -132,13 +132,9 @@
 
 fill_expr_slots(GoalInfo, Path0, SlotInfo, Goal0, Goal) :-
     (
-        Goal0 = conj(Goals0),
+        Goal0 = conj(ConjType, Goals0),
         fill_conj_slots(Path0, 0, SlotInfo, Goals0, Goals),
-        Goal = conj(Goals)
-    ;
-        Goal0 = par_conj(Goals0),
-        fill_conj_slots(Path0, 0, SlotInfo, Goals0, Goals),
-        Goal = par_conj(Goals)
+        Goal = conj(ConjType, Goals)
     ;
         Goal0 = disj(Goals0),
         fill_disj_slots(Path0, 0, SlotInfo, Goals0, Goals),
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.125
diff -u -b -r1.125 goal_util.m
--- compiler/goal_util.m	24 Feb 2006 01:41:46 -0000	1.125
+++ compiler/goal_util.m	24 Feb 2006 02:26:12 -0000
@@ -508,10 +508,8 @@
 
 %-----------------------------------------------------------------------------%
 
-rename_vars_in_goal_expr(Must, Subn, conj(Goals0), conj(Goals)) :-
-    rename_vars_in_goals(Must, Subn, Goals0, Goals).
-
-rename_vars_in_goal_expr(Must, Subn, par_conj(Goals0), par_conj(Goals)) :-
+rename_vars_in_goal_expr(Must, Subn, conj(ConjType, Goals0),
+        conj(ConjType, Goals)) :-
     rename_vars_in_goals(Must, Subn, Goals0, Goals).
 
 rename_vars_in_goal_expr(Must, Subn, disj(Goals0), disj(Goals)) :-
@@ -543,9 +541,9 @@
         Reason0 = promise_purity(_, _),
         Reason = Reason0
     ;
-        Reason0 = promise_equivalent_solutions(Vars0),
+        Reason0 = promise_solutions(Vars0, Kind),
         rename_var_list(Must, Subn, Vars0, Vars),
-        Reason = promise_equivalent_solutions(Vars)
+        Reason = promise_solutions(Vars, Kind)
     ;
         Reason0 = barrier(_),
         Reason = Reason0
@@ -800,10 +798,7 @@
 goal_vars_2(call(_, _, ArgVars, _, _, _), !Set) :-
     svset__insert_list(ArgVars, !Set).
 
-goal_vars_2(conj(Goals), !Set) :-
-    goals_goal_vars(Goals, !Set).
-
-goal_vars_2(par_conj(Goals), !Set) :-
+goal_vars_2(conj(_, Goals), !Set) :-
     goals_goal_vars(Goals, !Set).
 
 goal_vars_2(disj(Goals), !Set) :-
@@ -820,7 +815,7 @@
     ;
         Reason = promise_purity(_, _)
     ;
-        Reason = promise_equivalent_solutions(Vars),
+        Reason = promise_solutions(Vars, _),
         svset__insert_list(Vars, !Set)
     ;
         Reason = barrier(_)
@@ -907,13 +902,9 @@
 
 attach_features_goal_expr(Features, GoalExpr0, GoalExpr) :-
     (
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
         list__map(attach_features_to_all_goals(Features), Goals0, Goals),
-        GoalExpr = conj(Goals)
-    ;
-        GoalExpr0 = par_conj(Goals0),
-        list__map(attach_features_to_all_goals(Features), Goals0, Goals),
-        GoalExpr = par_conj(Goals)
+        GoalExpr = conj(ConjType, Goals)
     ;
         GoalExpr0 = disj(Goals0),
         list__map(attach_features_to_all_goals(Features), Goals0, Goals),
@@ -1042,11 +1033,15 @@
 
 :- pred goal_expr_size(hlds_goal_expr::in, int::out) is det.
 
-goal_expr_size(conj(Goals), Size) :-
-    goals_size(Goals, Size).
-goal_expr_size(par_conj(Goals), Size) :-
-    goals_size(Goals, Size1),
-    Size = Size1 + 1.
+goal_expr_size(conj(ConjType, Goals), Size) :-
+    goals_size(Goals, InnerSize),
+    (
+        ConjType = plain_conj,
+        Size = InnerSize
+    ;
+        ConjType = parallel_conj,
+        Size = InnerSize + 1
+    ).
 goal_expr_size(disj(Goals), Size) :-
     goals_size(Goals, Size1),
     Size = Size1 + 1.
@@ -1116,9 +1111,7 @@
 :- mode goal_expr_calls(in, in) is semidet.
 :- mode goal_expr_calls(in, out) is nondet.
 
-goal_expr_calls(conj(Goals), PredProcId) :-
-    goals_calls(Goals, PredProcId).
-goal_expr_calls(par_conj(Goals), PredProcId) :-
+goal_expr_calls(conj(_ConjType, Goals), PredProcId) :-
     goals_calls(Goals, PredProcId).
 goal_expr_calls(disj(Goals), PredProcId) :-
     goals_calls(Goals, PredProcId).
@@ -1176,9 +1169,7 @@
 :- mode goal_expr_calls_pred_id(in, in) is semidet.
 :- mode goal_expr_calls_pred_id(in, out) is nondet.
 
-goal_expr_calls_pred_id(conj(Goals), PredId) :-
-    goals_calls_pred_id(Goals, PredId).
-goal_expr_calls_pred_id(par_conj(Goals), PredId) :-
+goal_expr_calls_pred_id(conj(_ConjType, Goals), PredId) :-
     goals_calls_pred_id(Goals, PredId).
 goal_expr_calls_pred_id(disj(Goals), PredId) :-
     goals_calls_pred_id(Goals, PredId).
@@ -1207,12 +1198,10 @@
 
 :- pred goal_expr_contains_reconstruction(hlds_goal_expr::in) is semidet.
 
-goal_expr_contains_reconstruction(conj(Goals)) :-
+goal_expr_contains_reconstruction(conj(_ConjType, Goals)) :-
     goals_contain_reconstruction(Goals).
 goal_expr_contains_reconstruction(disj(Goals)) :-
     goals_contain_reconstruction(Goals).
-goal_expr_contains_reconstruction(par_conj(Goals)) :-
-    goals_contain_reconstruction(Goals).
 goal_expr_contains_reconstruction(switch(_, _, Cases)) :-
     list__member(Case, Cases),
     Case = case(_, Goal),
@@ -1235,18 +1224,11 @@
 
 %-----------------------------------------------------------------------------%
 
-    % goal_contains_goal(Goal, SubGoal) is true iff Goal contains SubGoal,
-    % i.e. iff Goal = SubGoal or Goal contains SubGoal as a direct
-    % or indirect sub-goal.
-    %
 goal_contains_goal(Goal, Goal).
 goal_contains_goal(Goal - _, SubGoal) :-
     direct_subgoal(Goal, DirectSubGoal),
     goal_contains_goal(DirectSubGoal, SubGoal).
 
-    % direct_subgoal(Goal, SubGoal) is true iff SubGoal is
-    % a direct sub-goal of Goal.
-    %
 direct_subgoal(scope(_, Goal), Goal).
 direct_subgoal(not(Goal), Goal).
 direct_subgoal(if_then_else(_, If, Then, Else), Goal) :-
@@ -1254,9 +1236,7 @@
     ; Goal = Then
     ; Goal = Else
     ).
-direct_subgoal(conj(ConjList), Goal) :-
-    list__member(Goal, ConjList).
-direct_subgoal(par_conj(ConjList), Goal) :-
+direct_subgoal(conj(_ConjType, ConjList), Goal) :-
     list__member(Goal, ConjList).
 direct_subgoal(disj(DisjList), Goal) :-
     list__member(Goal, DisjList).
@@ -1324,7 +1304,7 @@
     infer_goal_info_purity(CaseGoalInfo, CasePurity),
     goal_info_init(CaseNonLocals, InstMapDelta,
         Detism, CasePurity, CombinedGoalInfo),
-    Disjunct = conj(GoalList) - CombinedGoalInfo.
+    Disjunct = conj(plain_conj, GoalList) - CombinedGoalInfo.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/hhf.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hhf.m,v
retrieving revision 1.15
diff -u -b -r1.15 hhf.m
--- compiler/hhf.m	23 Feb 2006 09:36:52 -0000	1.15
+++ compiler/hhf.m	24 Feb 2006 02:26:22 -0000
@@ -236,14 +236,16 @@
         GoalExpr0 = foreign_proc(_, _, _, _, _, _),
         GoalExpr = GoalExpr0
     ;
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
         list__map_foldl(process_goal(NonLocals), Goals0, Goals1, !HI),
-        flatten_conj(Goals1, Goals),
-        GoalExpr = conj(Goals)
+        (
+            ConjType = plain_conj,
+            flatten_conj(Goals1, Goals)
     ;
-        GoalExpr0 = par_conj(Goals0),
-        list__map_foldl(process_goal(NonLocals), Goals0, Goals, !HI),
-        GoalExpr = par_conj(Goals)
+            ConjType = parallel_conj,
+            Goals = Goals1
+        ),
+        GoalExpr = conj(ConjType, Goals)
     ;
         GoalExpr0 = disj(Goals0),
         list__map_foldl(goal_use_own_nonlocals, Goals0, Goals, !HI),
@@ -312,7 +314,7 @@
     goal_info_set_nonlocals(GINonlocals, GoalInfo0, GoalInfo),
     UnifyGoal = unify(X, functor(ConsId, IsExistConstruct, Args),
         Mode, Unif, Context) - GoalInfo,
-    GoalExpr = conj([UnifyGoal | Unifications]).
+    GoalExpr = conj(plain_conj, [UnifyGoal | Unifications]).
 
 :- pred make_unifications(list(prog_var)::in, list(prog_var)::in,
     hlds_goal_info::in, unify_mode::in, unification::in, unify_context::in,
@@ -370,7 +372,7 @@
 flatten_conj([], []).
 flatten_conj([Goal | Goals0], Goals) :-
     flatten_conj(Goals0, Goals1),
-    ( Goal = conj(SubGoals) - _ ->
+    ( Goal = conj(plain_conj, SubGoals) - _ ->
         list__append(SubGoals, Goals1, Goals)
     ;
         Goals = [Goal | Goals1]
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.146
diff -u -b -r1.146 higher_order.m
--- compiler/higher_order.m	23 Feb 2006 09:36:52 -0000	1.146
+++ compiler/higher_order.m	24 Feb 2006 02:31:35 -0000
@@ -528,23 +528,23 @@
 :- pred traverse_goal_2(hlds_goal::in, hlds_goal::out,
     higher_order_info::in, higher_order_info::out) is det.
 
-traverse_goal_2(conj(Goals0) - GoalInfo, conj(Goals) - GoalInfo, !Info) :-
-    list.map_foldl(traverse_goal_2, Goals0, Goals, !Info).
-
-traverse_goal_2(par_conj(Goals0) - GoalInfo, par_conj(Goals) - GoalInfo,
-        !Info) :-
-    % traverse_disj treats its list of goals as independent
-    % rather than specifically disjoint, so we can use it
-    % to process a list of independent parallel conjuncts.
-    traverse_disj(Goals0, Goals, !Info).
+traverse_goal_2(conj(ConjType, Goals0) - GoalInfo,
+        conj(ConjType, Goals) - GoalInfo, !Info) :-
+    (
+        ConjType = plain_conj,
+        list.map_foldl(traverse_goal_2, Goals0, Goals, !Info)
+    ;
+        ConjType = parallel_conj,
+        traverse_independent_goals(Goals0, Goals, !Info)
+    ).
 
 traverse_goal_2(disj(Goals0) - GoalInfo, disj(Goals) - GoalInfo, !Info) :-
-    traverse_disj(Goals0, Goals, !Info).
+    traverse_independent_goals(Goals0, Goals, !Info).
 
-    % A switch is treated as a disjunction.
-    %
 traverse_goal_2(switch(Var, CanFail, Cases0) - GoalInfo,
         switch(Var, CanFail, Cases) - GoalInfo, !Info) :-
+    % A switch is treated as a disjunction.
+    %
     traverse_cases(Cases0, Cases, !Info).
 
     % Check whether this call could be specialized.
@@ -567,15 +567,15 @@
         Goal = Goal0
     ).
 
+traverse_goal_2(Goal0, Goal, !Info) :-
     % Check whether this call can be specialized.
     %
-traverse_goal_2(Goal0, Goal, !Info) :-
     Goal0 = call(_, _, _, _, _, _) - _,
     maybe_specialize_call(Goal0, Goal, !Info).
 
+traverse_goal_2(Goal0, Goal, !Info) :-
     % if-then-elses are handled as disjunctions.
     %
-traverse_goal_2(Goal0, Goal, !Info) :-
     Goal0 = if_then_else(Vars, Cond0, Then0, Else0) - GoalInfo,
     get_pre_branch_info(PreInfo, !Info),
     traverse_goal_2(Cond0, Cond, !Info),
@@ -620,31 +620,34 @@
     % specialization information before the goal, then merge the
     % results to give the specialization information after the disjunction.
     %
-    % This code is used both for disjunction and parallel conjunction.
+    % We do the same for parallel conjunctions.
     %
-:- pred traverse_disj(hlds_goals::in, hlds_goals::out,
+:- pred traverse_independent_goals(hlds_goals::in, hlds_goals::out,
     higher_order_info::in, higher_order_info::out) is det.
 
-traverse_disj([], [], !Info).
-traverse_disj([Goal0 | Goals0], [Goal | Goals], !Info) :-
+traverse_independent_goals([], [], !Info).
+traverse_independent_goals([Goal0 | Goals0], [Goal | Goals], !Info) :-
     get_pre_branch_info(PreInfo, !Info),
     traverse_goal_2(Goal0, Goal, !Info),
     get_post_branch_info(PostInfo0, !Info),
-    traverse_disj_2(PreInfo, Goals0, Goals, PostInfo0, PostInfo, !Info),
+    traverse_independent_goals_2(PreInfo, Goals0, Goals, PostInfo0, PostInfo,
+        !Info),
     set_post_branch_info(PostInfo, !Info).
 
-:- pred traverse_disj_2(pre_branch_info::in, hlds_goals::in, hlds_goals::out,
+:- pred traverse_independent_goals_2(pre_branch_info::in,
+    hlds_goals::in, hlds_goals::out,
     post_branch_info::in, post_branch_info::out,
     higher_order_info::in, higher_order_info::out) is det.
 
-traverse_disj_2(_, [], [], PostInfo, PostInfo, !Info).
-traverse_disj_2(PreInfo, [Goal0 | Goals0], [Goal | Goals],
+traverse_independent_goals_2(_, [], [], PostInfo, PostInfo, !Info).
+traverse_independent_goals_2(PreInfo, [Goal0 | Goals0], [Goal | Goals],
         PostInfo0, PostInfo, !Info) :-
     set_pre_branch_info(PreInfo, !Info),
     traverse_goal_2(Goal0, Goal, !Info),
     get_post_branch_info(PostInfo1, !Info),
     merge_post_branch_infos(PostInfo0, PostInfo1, PostInfo2),
-    traverse_disj_2(PreInfo, Goals0, Goals, PostInfo2, PostInfo, !Info).
+    traverse_independent_goals_2(PreInfo, Goals0, Goals, PostInfo2, PostInfo,
+        !Info).
 
     % Switches are treated in exactly the same way as disjunctions.
     %
@@ -1119,7 +1122,7 @@
             Result = specialized(ExtraTypeInfoGoals, Goal1),
             goal_to_conj_list(Goal1 - GoalInfo, GoalList1),
             list.append(ExtraTypeInfoGoals, GoalList1, GoalList),
-            Goal = conj(GoalList)
+            Goal = conj(plain_conj, GoalList)
         ;
             Result = not_specialized,
             Goal = Goal0
@@ -1232,7 +1235,8 @@
                 Goal = Goal2
             ;
                 ExtraTypeInfoGoals = [_ | _],
-                Goal = conj(ExtraTypeInfoGoals ++ [Goal2 - GoalInfo])
+                Goal = conj(plain_conj,
+                    ExtraTypeInfoGoals ++ [Goal2 - GoalInfo])
             )
         ;
             Result = not_specialized,
@@ -2037,7 +2041,7 @@
 specialize_unify_or_compare_pred_for_dummy(MaybeResult, GoalExpr, !Info) :-
     (
         MaybeResult = no,
-        GoalExpr = conj([])     % true
+        GoalExpr = conj(plain_conj, [])     % true
     ;
         MaybeResult = yes(ComparisonResult),
         Eq = cons(qualified(mercury_public_builtin_module, "="), 0),
@@ -2086,7 +2090,8 @@
             Detism = det,
             goal_info_init(NonLocals, InstMapDelta, Detism, purity_pure,
                 Context, GoalInfo),
-            GoalExpr = conj([CastGoal1, CastGoal2, Call - GoalInfo]),
+            GoalExpr = conj(plain_conj,
+                [CastGoal1, CastGoal2, Call - GoalInfo]),
             !:Info = !.Info ^ proc_info := ProcInfo
         )
     ).
@@ -2118,7 +2123,8 @@
             unify_context(explicit, [])),
         goal_info_init(NonLocals, InstMapDelta, Detism, purity_pure,
             Context, GoalInfo),
-        GoalExpr = conj([ExtractGoal1, ExtractGoal2, SpecialGoal - GoalInfo]),
+        GoalExpr = conj(plain_conj,
+            [ExtractGoal1, ExtractGoal2, SpecialGoal - GoalInfo]),
         !:Info = !.Info ^ proc_info := ProcInfo2
     ;
         MaybeResult = yes(ComparisonResult),
@@ -2138,7 +2144,7 @@
                 not_builtin, MaybeContext, SymName),
             goal_info_init(NonLocals, InstMapDelta, Detism, purity_pure,
                 Context, GoalInfo),
-            GoalExpr = conj([ExtractGoal1, ExtractGoal2,
+            GoalExpr = conj(plain_conj, [ExtractGoal1, ExtractGoal2,
                 SpecialGoal - GoalInfo]),
             !:Info = !.Info ^ proc_info := ProcInfo2
         ;
@@ -2152,7 +2158,8 @@
                 not_builtin, MaybeContext, SymName),
             goal_info_init(NonLocals, InstMapDelta, Detism, purity_pure,
                 Context, GoalInfo),
-            GoalExpr = conj([ExtractGoal1, CastGoal1, ExtractGoal2, CastGoal2,
+            GoalExpr = conj(plain_conj,
+                [ExtractGoal1, CastGoal1, ExtractGoal2, CastGoal2,
                 SpecialGoal - GoalInfo]),
             !:Info = !.Info ^ proc_info := ProcInfo4
         )
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.149
diff -u -b -r1.149 hlds_goal.m
--- compiler/hlds_goal.m	24 Feb 2006 01:41:46 -0000	1.149
+++ compiler/hlds_goal.m	24 Feb 2006 02:40:29 -0000
@@ -41,10 +41,33 @@
 
 :- type hlds_goal_expr
 
-    --->    conj(hlds_goals)
-            % A conjunction. NOTE: conjunctions must be fully flattened before
-            % mode analysis. As a general rule, it is a good idea to keep them
-            % flattened.
+    --->    unify(
+                % A unification. Initially only the terms and the context
+                % are known. Mode analysis fills in the missing information.
+
+                unify_lhs           :: prog_var,
+                                    % The variable on the left hand side
+                                    % of the unification.  NOTE: for
+                                    % convenience this field is duplicated
+                                    % in the unification structure below.
+
+                unify_rhs           :: unify_rhs,
+                                    % Whatever is on the right hand side
+                                    % of the unification.
+
+                unify_mode          :: unify_mode,
+                                    % the mode of the unification.
+
+                unify_kind          :: unification,
+                                    % This field says what category of
+                                    % unification it is, and contains
+                                    % information specific to each category.
+
+                unify_context       :: unify_context
+                                    % The location of the unification
+                                    % in the original source code
+                                    % (for use in error messages).
+            )
 
     ;       call(
                 % A predicate call. Initially only the sym_name, arguments,
@@ -96,6 +119,39 @@
                                     % The determinism of the call.
             )
 
+    ;       foreign_proc(
+                % Foreign code from a pragma foreign_proc(...) decl.
+
+                foreign_attr        :: pragma_foreign_proc_attributes,
+
+                foreign_pred_id     :: pred_id,
+                                    % The called predicate.
+
+                foreign_proc_id     :: proc_id,
+                                    % The mode of the predicate.
+
+                foreign_args        :: list(foreign_arg),
+                foreign_extra_args  :: list(foreign_arg),
+                                    % Extra arguments added when compiler
+                                    % passes such as tabling stuff more
+                                    % code into a foreign proc than the
+                                    % declared interface of the called
+                                    % Mercury procedure would allow.
+
+                foreign_impl        :: pragma_foreign_code_impl
+                                    % Extra information for model_non
+                                    % pragma_foreign_codes; none for others.
+            )
+
+    ;       conj(conj_type, hlds_goals)
+            % A conjunction. NOTE: plain conjunctions must be fully flattened
+            % before mode analysis. As a general rule, it is a good idea to
+            % keep them flattened.
+
+    ;       disj(hlds_goals)
+            % A disjunction.
+            % NOTE: disjunctions should be fully flattened.
+
     ;       switch(
                 % Deterministic disjunctions are converted into switches
                 % by the switch detection pass.
@@ -111,38 +167,6 @@
                 switch_cases        :: list(case)
             )
 
-    ;       unify(
-                % A unification. Initially only the terms and the context
-                % are known. Mode analysis fills in the missing information.
-
-                unify_lhs           :: prog_var,
-                                    % The variable on the left hand side
-                                    % of the unification.  NOTE: for
-                                    % convenience this field is duplicated
-                                    % in the unification structure below.
-
-                unify_rhs           :: unify_rhs,
-                                    % Whatever is on the right hand side
-                                    % of the unification.
-
-                unify_mode          :: unify_mode,
-                                    % the mode of the unification.
-
-                unify_kind          :: unification,
-                                    % This field says what category of
-                                    % unification it is, and contains
-                                    % information specific to each category.
-
-                unify_context       :: unify_context
-                                    % The location of the unification
-                                    % in the original source code
-                                    % (for use in error messages).
-            )
-
-    ;       disj(hlds_goals)
-            % A disjunction.
-            % NOTE: disjunctions should be fully flattened.
-
     ;       not(hlds_goal)
             % A negation.
 
@@ -172,39 +196,20 @@
                 ite_else            :: hlds_goal    % The <Else> part
             )
 
-    ;       foreign_proc(
-                % Foreign code from a pragma foreign_proc(...) decl.
-
-                foreign_attr        :: pragma_foreign_proc_attributes,
-
-                foreign_pred_id     :: pred_id,
-                                    % The called predicate.
-
-                foreign_proc_id     :: proc_id,
-                                    % The mode of the predicate.
-
-                foreign_args        :: list(foreign_arg),
-                foreign_extra_args  :: list(foreign_arg),
-                                    % Extra arguments added when compiler
-                                    % passes such as tabling stuff more
-                                    % code into a foreign proc than the
-                                    % declared interface of the called
-                                    % Mercury procedure would allow.
-
-                foreign_impl        :: pragma_foreign_code_impl
-                                    % Extra information for model_non
-                                    % pragma_foreign_codes; none for others.
-            )
-
-    ;       par_conj(hlds_goals)
-            % Parallel conjunction.
-
     ;       shorthand(shorthand_goal_expr).
             % Goals that stand for some other, usually bigger goal.
             % All shorthand goals are eliminated during or shortly after
             % the construction of the HLDS, so most passes of the compiler
             % will just call error/1 if they occur.
 
+:- type conj_type
+    --->    plain_conj
+    ;       parallel_conj.
+
+:- type after_semantic_analysis
+    --->    before_semantic_analysis
+    ;       after_semantic_analysis.
+
     % Instances of these `shorthand' goals are implemented by a
     % hlds --> hlds transformation that replaces them with
     % equivalent non-shorthand goals.
@@ -227,7 +232,7 @@
             % existentially quantified. The compiler may do whatever
             % preserves this fact.
 
-    ;       promise_equivalent_solutions(list(prog_var))
+    ;       promise_solutions(list(prog_var), promise_solutions_kind)
             % Even though the code inside the scope may have multiple
             % solutions, the creator of the scope (which may be the user
             % or a compiler pass) promises that all these solutions are
@@ -297,6 +302,10 @@
             % This kind of scope is not intended to be meaningful after
             % mode analysis, and should be removed after mode analysis.
 
+:- type promise_solutions_kind
+    --->    equivalent_solutions
+    ;       same_solutions.
+
 :- type removable
     --->    removable
     ;       not_removable.
@@ -1007,11 +1016,23 @@
                             % thousand). This feature may be attached to
                             % switches as well as disjunctions.
                             
-    ;       will_not_modify_trail.
+    ;       will_not_modify_trail
                             % This goal will not modify the trail, so it
                             % is safe for the compiler to omit trailing 
                             % primitives when generating code for this goal.
 
+    ;       promise_same_deconstruct.
+                            % This goal is a deconstruction unification
+                            % occurring in a promise_same_conj conjunction,
+                            % which would naturally have detism cc_multi
+                            % due to the deconstructed variable's type having
+                            % user-defined equality. However, this annotation
+                            % means that the programmer has promised that
+                            % the results of the conjunction don't depend
+                            % on which of the possible concrete representations
+                            % of the abstract value the deconstructed variable
+                            % actually has.
+
     % We can think of the goal that defines a procedure to be a tree,
     % whose leaves are primitive goals and whose interior nodes are
     % compound goals. These two types describe the position of a goal
@@ -1138,15 +1159,17 @@
 
     % Return the HLDS equivalent of `true'.
     %
-:- pred true_goal(hlds_goal::out) is det.
+:- func true_goal = hlds_goal.
+:- func true_goal_expr = hlds_goal_expr.
 
-:- pred true_goal(prog_context::in, hlds_goal::out) is det.
+:- func true_goal_with_context(prog_context) = hlds_goal.
 
     % Return the HLDS equivalent of `fail'.
     %
-:- pred fail_goal(hlds_goal::out) is det.
+:- func fail_goal = hlds_goal.
+:- func fail_goal_expr = hlds_goal_expr.
 
-:- pred fail_goal(prog_context::in, hlds_goal::out) is det.
+:- func fail_goal_with_context(prog_context) = hlds_goal.
 
     % Return the union of all the nonlocals of a list of goals.
     %
@@ -1850,14 +1873,14 @@
 %
 
 goal_to_conj_list(Goal, ConjList) :-
-    ( Goal = (conj(List) - _) ->
+    ( Goal = (conj(plain_conj, List) - _) ->
         ConjList = List
     ;
         ConjList = [Goal]
     ).
 
 goal_to_par_conj_list(Goal, ConjList) :-
-    ( Goal = par_conj(List) - _ ->
+    ( Goal = conj(parallel_conj, List) - _ ->
         ConjList = List
     ;
         ConjList = [Goal]
@@ -1874,14 +1897,14 @@
     ( ConjList = [Goal0] ->
         Goal = Goal0
     ;
-        Goal = conj(ConjList) - GoalInfo
+        Goal = conj(plain_conj, ConjList) - GoalInfo
     ).
 
 par_conj_list_to_goal(ConjList, GoalInfo, Goal) :-
     ( ConjList = [Goal0] ->
         Goal = Goal0
     ;
-        Goal = par_conj(ConjList) - GoalInfo
+        Goal = conj(parallel_conj, ConjList) - GoalInfo
     ).
 
 disj_list_to_goal(DisjList, GoalInfo, Goal) :-
@@ -1893,16 +1916,16 @@
 
 conjoin_goal_and_goal_list(Goal0, Goals, Goal) :-
     Goal0 = GoalExpr0 - GoalInfo0,
-    ( GoalExpr0 = conj(GoalList0) ->
+    ( GoalExpr0 = conj(plain_conj, GoalList0) ->
         list__append(GoalList0, Goals, GoalList),
-        GoalExpr = conj(GoalList)
+        GoalExpr = conj(plain_conj, GoalList)
     ;
-        GoalExpr = conj([Goal0 | Goals])
+        GoalExpr = conj(plain_conj, [Goal0 | Goals])
     ),
     Goal = GoalExpr - GoalInfo0.
 
 conjoin_goals(Goal1, Goal2, Goal) :-
-    ( Goal2 = conj(Goals2) - _ ->
+    ( Goal2 = conj(plain_conj, Goals2) - _ ->
         GoalList = Goals2
     ;
         GoalList = [Goal2]
@@ -1917,7 +1940,7 @@
         NegatedGoal = Goal1
     ;
         % Convert negated conjunctions of negations into disjunctions.
-        Goal = conj(NegatedGoals) - _,
+        Goal = conj(plain_conj, NegatedGoals) - _,
         all_negated(NegatedGoals, UnnegatedGoals)
     ->
         NegatedGoal = disj(UnnegatedGoals) - GoalInfo
@@ -1930,7 +1953,8 @@
 all_negated([], []).
 all_negated([not(Goal) - _ | NegatedGoals], [Goal | Goals]) :-
     all_negated(NegatedGoals, Goals).
-all_negated([conj(NegatedConj) - _GoalInfo | NegatedGoals], Goals) :-
+all_negated([conj(plain_conj, NegatedConj) - _GoalInfo | NegatedGoals],
+        Goals) :-
     all_negated(NegatedConj, Goals1),
     all_negated(NegatedGoals, Goals2),
     list__append(Goals1, Goals2, Goals).
@@ -1943,7 +1967,7 @@
 goal_has_foreign(Goal) = HasForeign :-
     Goal = GoalExpr - _,
     (
-        GoalExpr = conj(Goals),
+        GoalExpr = conj(_, Goals),
         HasForeign = goal_list_has_foreign(Goals)
     ;
         GoalExpr = call(_, _, _, _, _, _),
@@ -1982,9 +2006,6 @@
         GoalExpr = foreign_proc(_, _, _, _, _, _),
         HasForeign = yes
     ;
-        GoalExpr = par_conj(Goals),
-        HasForeign = goal_list_has_foreign(Goals)
-    ;
         GoalExpr = shorthand(ShorthandGoal),
         HasForeign = goal_has_foreign_shorthand(ShorthandGoal)
     ).
@@ -2023,33 +2044,37 @@
 goal_is_atomic(generic_call(_, _, _, _)) = yes.
 goal_is_atomic(call(_, _, _, _, _, _)) = yes.
 goal_is_atomic(foreign_proc(_, _, _, _, _,  _)) = yes.
-goal_is_atomic(conj(Conj)) =
+goal_is_atomic(conj(plain_conj, Conj)) =
     ( Conj = [] -> yes ; no ).
+goal_is_atomic(conj(parallel_conj, _)) = no.
 goal_is_atomic(disj(Disj)) =
     ( Disj = [] -> yes ; no ).
 goal_is_atomic(if_then_else(_, _, _, _)) = no.
 goal_is_atomic(not(_)) = no.
 goal_is_atomic(switch(_, _, _)) = no.
 goal_is_atomic(scope(_, _)) = no.
-goal_is_atomic(par_conj(_)) = no.
 goal_is_atomic(shorthand(_)) = no.
 
 %-----------------------------------------------------------------------------%
 
-true_goal(conj([]) - GoalInfo) :-
+true_goal = true_goal_expr - GoalInfo :-
     instmap_delta_init_reachable(InstMapDelta),
     goal_info_init(set__init, InstMapDelta, det, purity_pure, GoalInfo).
 
-true_goal(Context, Goal - GoalInfo) :-
-    true_goal(Goal - GoalInfo0),
+true_goal_expr = conj(plain_conj, []).
+
+true_goal_with_context(Context) = Goal - GoalInfo :-
+    Goal - GoalInfo0 = true_goal,
     goal_info_set_context(Context, GoalInfo0, GoalInfo).
 
-fail_goal(disj([]) - GoalInfo) :-
+fail_goal = fail_goal_expr - GoalInfo :-
     instmap_delta_init_unreachable(InstMapDelta),
     goal_info_init(set__init, InstMapDelta, failure, purity_pure, GoalInfo).
 
-fail_goal(Context, Goal - GoalInfo) :-
-    fail_goal(Goal - GoalInfo0),
+fail_goal_expr = disj([]).
+
+fail_goal_with_context(Context) = Goal - GoalInfo :-
+    Goal - GoalInfo0 = fail_goal,
     goal_info_set_context(Context, GoalInfo0, GoalInfo).
 
 %-----------------------------------------------------------------------------%
@@ -2096,11 +2121,9 @@
 :- pred set_goal_contexts_2(prog_context::in, hlds_goal_expr::in,
     hlds_goal_expr::out) is det.
 
-set_goal_contexts_2(Context, conj(Goals0), conj(Goals)) :-
+set_goal_contexts_2(Context, conj(ConjType, Goals0), conj(ConjType, Goals)) :-
     list__map(set_goal_contexts(Context), Goals0, Goals).
 set_goal_contexts_2(Context, disj(Goals0), disj(Goals)) :-
-    list__map(set_goal_contexts(Context), Goals0, Goals).
-set_goal_contexts_2(Context, par_conj(Goals0), par_conj(Goals)) :-
     list__map(set_goal_contexts(Context), Goals0, Goals).
 set_goal_contexts_2(Context, if_then_else(Vars, Cond0, Then0, Else0),
         if_then_else(Vars, Cond, Then, Else)) :-
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.381
diff -u -b -r1.381 hlds_out.m
--- compiler/hlds_out.m	24 Feb 2006 01:41:47 -0000	1.381
+++ compiler/hlds_out.m	24 Feb 2006 03:46:22 -0000
@@ -1110,7 +1110,7 @@
             Modes, VarSet, AppendVarNums, HeadTerms, PredOrFunc,
             UseDeclaredModes, !IO)
     ),
-    ( Goal = conj([]) - _GoalInfo ->
+    ( Goal = conj(plain_conj, []) - _GoalInfo ->
         io__write_string(".\n", !IO)
     ;
         io__write_string(" :-\n", !IO),
@@ -1475,8 +1475,15 @@
             io__write_string("\n", !IO)
         )
     ;
-        Reason = promise_equivalent_solutions(Vars),
-        io__write_string("promise_equivalent_solutions [", !IO),
+        Reason = promise_solutions(Vars, Kind),
+        (
+            Kind = equivalent_solutions,
+            io__write_string("promise_equivalent_solutions", !IO)
+        ;
+            Kind = same_solutions,
+            io__write_string("promise_same_solutions", !IO)
+        ),
+        io__write_string(" [", !IO),
         mercury_output_vars(Vars, VarSet, AppendVarNums, !IO),
         io__write_string("] (\n", !IO)
     ;
@@ -1553,10 +1560,12 @@
     io__write_string(")", !IO),
     io__write_string(Follow, !IO).
 
-write_goal_2(conj(List), ModuleInfo, VarSet, AppendVarNums, Indent, Follow,
-        TypeQual, !IO) :-
+write_goal_2(conj(ConjType, List), ModuleInfo, VarSet, AppendVarNums, Indent,
+        Follow, TypeQual, !IO) :-
     (
         List = [Goal | Goals],
+        (
+            ConjType = plain_conj,
         globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
         ( Verbose \= "" ->
             write_indent(Indent, !IO),
@@ -1567,31 +1576,31 @@
             io__write_string(")", !IO),
             io__write_string(Follow, !IO)
         ;
-            write_conj(Goal, Goals, ModuleInfo, VarSet, AppendVarNums, Indent,
-                Follow, Verbose, ",\n", TypeQual, !IO)
+                write_conj(Goal, Goals, ModuleInfo, VarSet, AppendVarNums,
+                    Indent, Follow, Verbose, ",\n", TypeQual, !IO)
         )
     ;
-        List = [],
-        write_indent(Indent, !IO),
-        io__write_string("true", !IO),
-        io__write_string(Follow, !IO)
-    ).
-
-write_goal_2(par_conj(List), ModuleInfo, VarSet, AppendVarNums, Indent, Follow,
-        TypeQual, !IO) :-
-    write_indent(Indent, !IO),
-    ( List = [Goal | Goals] ->
+            ConjType = parallel_conj,
         io__write_string("( % parallel conjunction\n", !IO),
-        write_goal_a(Goal, ModuleInfo, VarSet, AppendVarNums, Indent + 1, "\n",
-            TypeQual, !IO),
+            write_goal_a(Goal, ModuleInfo, VarSet, AppendVarNums, Indent + 1,
+                "\n", TypeQual, !IO),
         % See comments at write_goal_list.
         write_goal_list(Goals, ModuleInfo, VarSet, AppendVarNums, Indent,
             "&\n", TypeQual, !IO),
         write_indent(Indent, !IO),
         io__write_string(")", !IO),
         io__write_string(Follow, !IO)
+        )
     ;
-        io__write_string("/* parallel */ true", !IO),
+        List = [],
+        write_indent(Indent, !IO),
+        (
+            ConjType = plain_conj,
+            io__write_string("true", !IO)
+        ;
+            ConjType = parallel_conj,
+            io__write_string("/* parallel */ true", !IO)
+        ),
         io__write_string(Follow, !IO)
     ).
 
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.190
diff -u -b -r1.190 hlds_pred.m
--- compiler/hlds_pred.m	24 Feb 2006 01:41:47 -0000	1.190
+++ compiler/hlds_pred.m	24 Feb 2006 01:44:25 -0000
@@ -2929,7 +2929,7 @@
     set__init(InitialLiveness),
     ArgInfo = no,
     goal_info_init(GoalInfo),
-    ClauseBody = conj([]) - GoalInfo,
+    ClauseBody = conj(plain_conj, []) - GoalInfo,
     CanProcess = yes,
     rtti_varmaps_init(RttiVarMaps),
     Term2Info = term_constr_main__term2_info_init,
Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.133
diff -u -b -r1.133 inlining.m
--- compiler/inlining.m	23 Feb 2006 09:36:53 -0000	1.133
+++ compiler/inlining.m	24 Feb 2006 02:31:47 -0000
@@ -96,11 +96,11 @@
 
     % This heuristic is used for both local and intermodule inlining.
     %
-:- pred inlining__is_simple_clause_list(list(clause)::in, int::in) is semidet.
+:- pred is_simple_clause_list(list(clause)::in, int::in) is semidet.
 
-:- pred inlining__is_simple_goal(hlds_goal::in, int::in) is semidet.
+:- pred is_simple_goal(hlds_goal::in, int::in) is semidet.
 
-    % inlining__do_inline_call(UnivQVars, Args, CalledPredInfo, CalledProcInfo,
+    % do_inline_call(UnivQVars, Args, CalledPredInfo, CalledProcInfo,
     %   !VarSet, !VarTypes, !TVarSet, !RttiVarMaps):
     %
     % Given the universally quantified type variables in the caller's type,
@@ -109,36 +109,36 @@
     % procedure currently being analysed, rename the goal for the called
     % procedure so that it can be inlined.
     %
-:- pred inlining__do_inline_call(list(tvar)::in, list(prog_var)::in,
+:- pred do_inline_call(list(tvar)::in, list(prog_var)::in,
     pred_info::in, proc_info::in, prog_varset::in, prog_varset::out,
     vartypes::in, vartypes::out, tvarset::in, tvarset::out,
     rtti_varmaps::in, rtti_varmaps::out, hlds_goal::out) is det.
 
-    % inlining__get_type_substitution(CalleeArgTypes, CallerArgTypes,
+    % get_type_substitution(CalleeArgTypes, CallerArgTypes,
     %   HeadTypeParams, CalleeExistQTVars, TypeSubn):
     %
     % Work out a type substitution to map the callee's argument types
     % into the caller's.
     %
-:- pred inlining__get_type_substitution(list(mer_type)::in, list(mer_type)::in,
+:- pred get_type_substitution(list(mer_type)::in, list(mer_type)::in,
     head_type_params::in, list(tvar)::in, map(tvar, mer_type)::out) is det.
 
-    % inlining__rename_goal(CalledProcHeadVars, CallArgs,
+    % rename_goal(CalledProcHeadVars, CallArgs,
     %   CallerVarSet0, CalleeVarSet, CallerVarSet,
     %   CallerVarTypes0, CalleeVarTypes, CallerVarTypes,
     %   VarRenaming, CalledGoal, RenamedGoal).
     %
-:- pred inlining__rename_goal(list(prog_var)::in, list(prog_var)::in,
+:- pred rename_goal(list(prog_var)::in, list(prog_var)::in,
     prog_varset::in, prog_varset::in, prog_varset::out,
     vartypes::in, vartypes::in, vartypes::out,
     map(prog_var, prog_var)::out, hlds_goal::in, hlds_goal::out) is det.
 
-    % inlining__can_inline_proc(PredId, ProcId, BuiltinState,
+    % can_inline_proc(PredId, ProcId, BuiltinState,
     %   InlinePromisedPure, CallingPredMarkers, ModuleInfo):
     %
     % Determine whether a predicate can be inlined.
     %
-:- pred inlining__can_inline_proc(pred_id::in, proc_id::in, builtin_state::in,
+:- pred can_inline_proc(pred_id::in, proc_id::in, builtin_state::in,
     bool::in, pred_markers::in, module_info::in) is semidet.
 
 %-----------------------------------------------------------------------------%
@@ -250,32 +250,29 @@
     hlds_dependency_info_get_dependency_ordering(DepInfo, SCCs),
     list__condense(SCCs, PredProcs),
     set__init(InlinedProcs0),
-    inlining__do_inlining(PredProcs, NeededMap, Params, InlinedProcs0,
-        !ModuleInfo, !IO),
+    do_inlining(PredProcs, NeededMap, Params, InlinedProcs0, !ModuleInfo, !IO),
 
     % The dependency graph is now out of date and needs to be rebuilt.
     module_info_clobber_dependency_info(!ModuleInfo).
 
-:- pred inlining__do_inlining(list(pred_proc_id)::in, needed_map::in,
+:- pred do_inlining(list(pred_proc_id)::in, needed_map::in,
     inline_params::in, set(pred_proc_id)::in,
     module_info::in, module_info::out, io::di, io::uo) is det.
 
-inlining__do_inlining([], _Needed, _Params, _Inlined, !Module, !IO).
-inlining__do_inlining([PPId | PPIds], Needed, Params, !.Inlined, !Module,
-        !IO) :-
-    inlining__in_predproc(PPId, !.Inlined, Params, !Module, !IO),
-    inlining__mark_predproc(PPId, Needed, Params, !.Module, !Inlined, !IO),
-    inlining__do_inlining(PPIds, Needed, Params, !.Inlined, !Module, !IO).
+do_inlining([], _Needed, _Params, _Inlined, !Module, !IO).
+do_inlining([PPId | PPIds], Needed, Params, !.Inlined, !Module, !IO) :-
+    in_predproc(PPId, !.Inlined, Params, !Module, !IO),
+    mark_predproc(PPId, Needed, Params, !.Module, !Inlined, !IO),
+    do_inlining(PPIds, Needed, Params, !.Inlined, !Module, !IO).
 
     % This predicate effectively adds implicit `pragma inline' directives
     % for procedures that match its heuristic.
     %
-:- pred inlining__mark_predproc(pred_proc_id::in, needed_map::in,
+:- pred mark_predproc(pred_proc_id::in, needed_map::in,
     inline_params::in, module_info::in,
     set(pred_proc_id)::in, set(pred_proc_id)::out, io::di, io::uo) is det.
 
-inlining__mark_predproc(PredProcId, NeededMap, Params, ModuleInfo,
-        !InlinedProcs, !IO) :-
+mark_predproc(PredProcId, NeededMap, Params, ModuleInfo, !InlinedProcs, !IO) :-
     (
         Simple = Params ^ simple,
         SingleUse = Params ^ single_use,
@@ -292,7 +289,7 @@
         % The heuristic represented by the following code could be improved.
         (
             Simple = yes,
-            inlining__is_simple_goal(CalledGoal, SimpleThreshold)
+            is_simple_goal(CalledGoal, SimpleThreshold)
         ;
             CompoundThreshold > 0,
             map__search(NeededMap, Entity, Needed),
@@ -312,13 +309,12 @@
         % Don't inline recursive predicates (unless explicitly requested).
         \+ goal_calls(CalledGoal, PredProcId)
     ->
-        inlining__mark_proc_as_inlined(PredProcId, ModuleInfo,
-            !InlinedProcs, !IO)
+        mark_proc_as_inlined(PredProcId, ModuleInfo, !InlinedProcs, !IO)
     ;
         true
     ).
 
-inlining__is_simple_clause_list(Clauses, SimpleThreshold) :-
+is_simple_clause_list(Clauses, SimpleThreshold) :-
     clause_list_size(Clauses, Size),
     (
         Size < SimpleThreshold
@@ -331,10 +327,10 @@
         % XXX This should be a separate option, we shouldn't hardcode
         % the number `3' (which is just a guess).
         %
-        inlining__is_flat_simple_goal(Goal)
+        is_flat_simple_goal(Goal)
     ).
 
-inlining__is_simple_goal(CalledGoal, SimpleThreshold) :-
+is_simple_goal(CalledGoal, SimpleThreshold) :-
     goal_size(CalledGoal, Size),
     (
         Size < SimpleThreshold
@@ -346,32 +342,32 @@
         % the number `3' (which is just a guess).
         %
         Size < SimpleThreshold * 3,
-        inlining__is_flat_simple_goal(CalledGoal)
+        is_flat_simple_goal(CalledGoal)
     ).
 
-:- pred inlining__is_flat_simple_goal(hlds_goal::in) is semidet.
+:- pred is_flat_simple_goal(hlds_goal::in) is semidet.
 
-inlining__is_flat_simple_goal(conj(Goals) - _) :-
-    inlining__is_flat_simple_goal_list(Goals).
-inlining__is_flat_simple_goal(not(Goal) - _) :-
-    inlining__is_flat_simple_goal(Goal).
-inlining__is_flat_simple_goal(scope(_, Goal) - _) :-
-    inlining__is_flat_simple_goal(Goal).
-inlining__is_flat_simple_goal(call(_, _, _, BuiltinState, _, _) - _) :-
+is_flat_simple_goal(conj(plain_conj, Goals) - _) :-
+    is_flat_simple_goal_list(Goals).
+is_flat_simple_goal(not(Goal) - _) :-
+    is_flat_simple_goal(Goal).
+is_flat_simple_goal(scope(_, Goal) - _) :-
+    is_flat_simple_goal(Goal).
+is_flat_simple_goal(call(_, _, _, BuiltinState, _, _) - _) :-
     BuiltinState = inline_builtin.
-inlining__is_flat_simple_goal(unify(_, _, _, _, _) - _).
+is_flat_simple_goal(unify(_, _, _, _, _) - _).
 
-:- pred inlining__is_flat_simple_goal_list(hlds_goals::in) is semidet.
+:- pred is_flat_simple_goal_list(hlds_goals::in) is semidet.
 
-inlining__is_flat_simple_goal_list([]).
-inlining__is_flat_simple_goal_list([Goal | Goals]) :-
-    inlining__is_flat_simple_goal(Goal),
-    inlining__is_flat_simple_goal_list(Goals).
+is_flat_simple_goal_list([]).
+is_flat_simple_goal_list([Goal | Goals]) :-
+    is_flat_simple_goal(Goal),
+    is_flat_simple_goal_list(Goals).
 
-:- pred inlining__mark_proc_as_inlined(pred_proc_id::in, module_info::in,
+:- pred mark_proc_as_inlined(pred_proc_id::in, module_info::in,
     set(pred_proc_id)::in, set(pred_proc_id)::out, io::di, io::uo) is det.
 
-inlining__mark_proc_as_inlined(proc(PredId, ProcId), ModuleInfo,
+mark_proc_as_inlined(proc(PredId, ProcId), ModuleInfo,
         !InlinedProcs, !IO) :-
     set__insert(!.InlinedProcs, proc(PredId, ProcId), !:InlinedProcs),
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
@@ -441,11 +437,10 @@
                                     % any subgoal.
             ).
 
-:- pred inlining__in_predproc(pred_proc_id::in, set(pred_proc_id)::in,
-    inline_params::in, module_info::in, module_info::out,
-    io::di, io::uo) is det.
+:- pred in_predproc(pred_proc_id::in, set(pred_proc_id)::in, inline_params::in,
+    module_info::in, module_info::out, io::di, io::uo) is det.
 
-inlining__in_predproc(PredProcId, InlinedProcs, Params, !ModuleInfo, !IO) :-
+in_predproc(PredProcId, InlinedProcs, Params, !ModuleInfo, !IO) :-
     VarThresh = Params ^ var_threshold,
     HighLevelCode = Params ^ highlevel_code,
     AnyTracing = Params ^ any_tracing,
@@ -477,7 +472,7 @@
             VarSet0, VarTypes0, TypeVarSet0, RttiVarMaps0,
             DidInlining0, Requantify0, DetChanged0, PurityChanged0),
 
-        inlining__inlining_in_goal(Goal0, Goal, InlineInfo0, InlineInfo),
+        inlining_in_goal(Goal0, Goal, InlineInfo0, InlineInfo),
 
         InlineInfo = inline_info(_, _, _, _, _, _, _, VarSet, VarTypes,
             TypeVarSet, RttiVarMaps, DidInlining, Requantify,
@@ -531,45 +526,46 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred inlining__inlining_in_goal(hlds_goal::in, hlds_goal::out,
+:- pred inlining_in_goal(hlds_goal::in, hlds_goal::out,
     inline_info::in, inline_info::out) is det.
 
-inlining__inlining_in_goal(Goal0 - GoalInfo0, Goal - GoalInfo, !Info) :-
+inlining_in_goal(Goal0 - GoalInfo0, Goal - GoalInfo, !Info) :-
     (
-        Goal0 = conj(Goals0),
-        inlining__inlining_in_conj(Goals0, Goals, !Info),
-        Goal = conj(Goals),
-        GoalInfo = GoalInfo0
+        Goal0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
+            inlining_in_conj(Goals0, Goals, !Info)
     ;
-        Goal0 = par_conj(Goals0),
-        inlining__inlining_in_disj(Goals0, Goals, !Info),
-        Goal = par_conj(Goals),
+            ConjType = parallel_conj,
+            inlining_in_goals(Goals0, Goals, !Info)
+        ),
+        Goal = conj(ConjType, Goals),
         GoalInfo = GoalInfo0
     ;
         Goal0 = disj(Goals0),
-        inlining__inlining_in_disj(Goals0, Goals, !Info),
+        inlining_in_goals(Goals0, Goals, !Info),
         Goal = disj(Goals),
         GoalInfo = GoalInfo0
     ;
         Goal0 = switch(Var, Det, Cases0),
-        inlining__inlining_in_cases(Cases0, Cases, !Info),
+        inlining_in_cases(Cases0, Cases, !Info),
         Goal = switch(Var, Det, Cases),
         GoalInfo = GoalInfo0
     ;
         Goal0 = if_then_else(Vars, Cond0, Then0, Else0),
-        inlining__inlining_in_goal(Cond0, Cond, !Info),
-        inlining__inlining_in_goal(Then0, Then, !Info),
-        inlining__inlining_in_goal(Else0, Else, !Info),
+        inlining_in_goal(Cond0, Cond, !Info),
+        inlining_in_goal(Then0, Then, !Info),
+        inlining_in_goal(Else0, Else, !Info),
         Goal = if_then_else(Vars, Cond, Then, Else),
         GoalInfo = GoalInfo0
     ;
         Goal0 = not(SubGoal0),
-        inlining__inlining_in_goal(SubGoal0, SubGoal, !Info),
+        inlining_in_goal(SubGoal0, SubGoal, !Info),
         Goal = not(SubGoal),
         GoalInfo = GoalInfo0
     ;
         Goal0 = scope(Reason, SubGoal0),
-        inlining__inlining_in_goal(SubGoal0, SubGoal, !Info),
+        inlining_in_goal(SubGoal0, SubGoal, !Info),
         Goal = scope(Reason, SubGoal),
         GoalInfo = GoalInfo0
     ;
@@ -590,28 +586,27 @@
         unexpected(this_file, "inlining_in_goal: unexpected shorthand")
     ;
         Goal0 = call(PredId, ProcId, ArgVars, Builtin, Context, Sym),
-        inlining__inlining_in_call(PredId, ProcId, ArgVars, Builtin,
+        inlining_in_call(PredId, ProcId, ArgVars, Builtin,
             Context, Sym, Goal, GoalInfo0, GoalInfo, !Info)
     ).
 
-:- pred inlining__inlining_in_call(pred_id::in, proc_id::in,
+:- pred inlining_in_call(pred_id::in, proc_id::in,
     list(prog_var)::in, builtin_state::in, maybe(call_unify_context)::in,
     sym_name::in, hlds_goal_expr::out,
     hlds_goal_info::in, hlds_goal_info::out,
     inline_info::in, inline_info::out) is det.
 
-inlining__inlining_in_call(PredId, ProcId, ArgVars, Builtin,
+inlining_in_call(PredId, ProcId, ArgVars, Builtin,
         Context, Sym, Goal, GoalInfo0, GoalInfo, !Info) :-
     !.Info = inline_info(VarThresh, HighLevelCode, AnyTracing,
         InlinedProcs, ModuleInfo, HeadTypeParams, Markers,
         VarSet0, VarTypes0, TypeVarSet0, RttiVarMaps0,
         _DidInlining0, Requantify0, DetChanged0, PurityChanged0),
 
-    module_info_pred_proc_info(ModuleInfo, PredId, ProcId,
-        PredInfo, ProcInfo),
+    module_info_pred_proc_info(ModuleInfo, PredId, ProcId, PredInfo, ProcInfo),
     % Should we inline this call?
     (
-        inlining__should_inline_proc(PredId, ProcId, Builtin, HighLevelCode,
+        should_inline_proc(PredId, ProcId, Builtin, HighLevelCode,
             AnyTracing, InlinedProcs, Markers, ModuleInfo, UserReq),
         (
             UserReq = yes
@@ -629,7 +624,7 @@
             TotalVars =< VarThresh
         )
     ->
-        inlining__do_inline_call(HeadTypeParams, ArgVars, PredInfo, ProcInfo,
+        do_inline_call(HeadTypeParams, ArgVars, PredInfo, ProcInfo,
             VarSet0, VarSet, VarTypes0, VarTypes, TypeVarSet0, TypeVarSet,
             RttiVarMaps0, RttiVarMaps, Goal - GoalInfo),
 
@@ -673,7 +668,7 @@
 
 %-----------------------------------------------------------------------------%
 
-inlining__do_inline_call(HeadTypeParams, ArgVars, PredInfo, ProcInfo,
+do_inline_call(HeadTypeParams, ArgVars, PredInfo, ProcInfo,
         VarSet0, VarSet, VarTypes0, VarTypes, TypeVarSet0, TypeVarSet,
         RttiVarMaps0, RttiVarMaps, Goal) :-
 
@@ -721,7 +716,7 @@
     map__apply_to_list(ArgVars, VarTypes0, ArgTypes),
 
     pred_info_get_exist_quant_tvars(PredInfo, CalleeExistQVars),
-    inlining__get_type_substitution(HeadTypes, ArgTypes, HeadTypeParams,
+    get_type_substitution(HeadTypes, ArgTypes, HeadTypeParams,
         CalleeExistQVars, TypeSubn),
 
     % Handle the common case of non-existentially typed preds specially,
@@ -740,7 +735,7 @@
     ),
 
     % Now rename apart the variables in the called goal.
-    inlining__rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
+    rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
         VarSet, VarTypes1, CalleeVarTypes, VarTypes, Subn,
         CalledGoal, Goal),
 
@@ -754,7 +749,7 @@
     % be the same.
     rtti_varmaps_overlay(CalleeRttiVarMaps1, RttiVarMaps0, RttiVarMaps).
 
-inlining__get_type_substitution(HeadTypes, ArgTypes,
+get_type_substitution(HeadTypes, ArgTypes,
         HeadTypeParams, CalleeExistQVars, TypeSubn) :-
     ( CalleeExistQVars = [] ->
         ( type_list_subsumes(HeadTypes, ArgTypes, TypeSubn0) ->
@@ -786,7 +781,7 @@
         )
     ).
 
-inlining__rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
+rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
         VarSet, VarTypes1, CalleeVarTypes, VarTypes, Subn,
         CalledGoal, Goal) :-
     map__from_corresponding_lists(HeadVars, ArgVars, Subn0),
@@ -798,40 +793,40 @@
 
 %-----------------------------------------------------------------------------%
 
-    % inlining__inlining_in_disj is used for both disjunctions and
+    % inlining_in_goals is used for both disjunctions and
     % parallel conjunctions.
     %
-:- pred inlining__inlining_in_disj(list(hlds_goal)::in, list(hlds_goal)::out,
+:- pred inlining_in_goals(list(hlds_goal)::in, list(hlds_goal)::out,
     inline_info::in, inline_info::out) is det.
 
-inlining__inlining_in_disj([], [], !Info).
-inlining__inlining_in_disj([Goal0 | Goals0], [Goal | Goals], !Info) :-
-    inlining__inlining_in_goal(Goal0, Goal, !Info),
-    inlining__inlining_in_disj(Goals0, Goals, !Info).
+inlining_in_goals([], [], !Info).
+inlining_in_goals([Goal0 | Goals0], [Goal | Goals], !Info) :-
+    inlining_in_goal(Goal0, Goal, !Info),
+    inlining_in_goals(Goals0, Goals, !Info).
 
 %-----------------------------------------------------------------------------%
 
-:- pred inlining__inlining_in_cases(list(case)::in, list(case)::out,
+:- pred inlining_in_cases(list(case)::in, list(case)::out,
     inline_info::in, inline_info::out) is det.
 
-inlining__inlining_in_cases([], [], !Info).
-inlining__inlining_in_cases([case(Cons, Goal0) | Goals0],
-        [case(Cons, Goal) | Goals], !Info) :-
-    inlining__inlining_in_goal(Goal0, Goal, !Info),
-    inlining__inlining_in_cases(Goals0, Goals, !Info).
+inlining_in_cases([], [], !Info).
+inlining_in_cases([case(Cons, Goal0) | Goals0], [case(Cons, Goal) | Goals],
+        !Info) :-
+    inlining_in_goal(Goal0, Goal, !Info),
+    inlining_in_cases(Goals0, Goals, !Info).
 
 %-----------------------------------------------------------------------------%
 
-:- pred inlining__inlining_in_conj(list(hlds_goal)::in, list(hlds_goal)::out,
+:- pred inlining_in_conj(list(hlds_goal)::in, list(hlds_goal)::out,
     inline_info::in, inline_info::out) is det.
 
-inlining__inlining_in_conj([], [], !Info).
-inlining__inlining_in_conj([Goal0 | Goals0], Goals, !Info) :-
+inlining_in_conj([], [], !Info).
+inlining_in_conj([Goal0 | Goals0], Goals, !Info) :-
     % Since a single goal may become a conjunction,
     % we flatten the conjunction as we go.
-    inlining__inlining_in_goal(Goal0, Goal1, !Info),
+    inlining_in_goal(Goal0, Goal1, !Info),
     goal_to_conj_list(Goal1, Goal1List),
-    inlining__inlining_in_conj(Goals0, Goals1, !Info),
+    inlining_in_conj(Goals0, Goals1, !Info),
     list__append(Goal1List, Goals1, Goals).
 
 %-----------------------------------------------------------------------------%
@@ -843,16 +838,16 @@
     %
     % It succeeds if the called procedure is inlinable, and in addition
     % either there was a `pragma inline' for this procedure, or the procedure
-    % was marked by inlining__mark_predproc as having met its heuristic.
+    % was marked by mark_predproc as having met its heuristic.
     %
-:- pred inlining__should_inline_proc(pred_id::in, proc_id::in,
+:- pred should_inline_proc(pred_id::in, proc_id::in,
     builtin_state::in, bool::in, bool::in, set(pred_proc_id)::in,
     pred_markers::in, module_info::in, bool::out) is semidet.
 
-inlining__should_inline_proc(PredId, ProcId, BuiltinState, HighLevelCode,
+should_inline_proc(PredId, ProcId, BuiltinState, HighLevelCode,
         _Tracing, InlinedProcs, CallingPredMarkers, ModuleInfo, UserReq) :-
     InlinePromisedPure = yes,
-    inlining__can_inline_proc_2(PredId, ProcId, BuiltinState,
+    can_inline_proc_2(PredId, ProcId, BuiltinState,
         HighLevelCode, InlinePromisedPure, CallingPredMarkers, ModuleInfo),
     % OK, we could inline it - but should we?  Apply our heuristic.
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
@@ -869,25 +864,22 @@
         fail
     ).
 
-inlining__can_inline_proc(PredId, ProcId, BuiltinState, InlinePromisedPure,
+can_inline_proc(PredId, ProcId, BuiltinState, InlinePromisedPure,
         CallingPredMarkers, ModuleInfo) :-
     module_info_get_globals(ModuleInfo, Globals),
     globals__lookup_bool_option(Globals, highlevel_code, HighLevelCode),
-    inlining__can_inline_proc_2(PredId, ProcId, BuiltinState,
-        HighLevelCode, InlinePromisedPure,
-        CallingPredMarkers, ModuleInfo).
+    can_inline_proc_2(PredId, ProcId, BuiltinState, HighLevelCode,
+        InlinePromisedPure, CallingPredMarkers, ModuleInfo).
 
-:- pred inlining__can_inline_proc_2(pred_id::in, proc_id::in,
+:- pred can_inline_proc_2(pred_id::in, proc_id::in,
     builtin_state::in, bool::in, bool::in, pred_markers::in, module_info::in)
     is semidet.
 
-inlining__can_inline_proc_2(PredId, ProcId, BuiltinState, HighLevelCode,
+can_inline_proc_2(PredId, ProcId, BuiltinState, HighLevelCode,
         InlinePromisedPure, _CallingPredMarkers, ModuleInfo) :-
-
     % Don't inline builtins, the code generator will handle them.
     BuiltinState = not_builtin,
-    module_info_pred_proc_info(ModuleInfo, PredId, ProcId, PredInfo,
-        ProcInfo),
+    module_info_pred_proc_info(ModuleInfo, PredId, ProcId, PredInfo, ProcInfo),
 
     % Don't try to inline imported predicates, since we don't
     % have the code for them.
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.191
diff -u -b -r1.191 intermod.m
--- compiler/intermod.m	24 Feb 2006 01:41:48 -0000	1.191
+++ compiler/intermod.m	24 Feb 2006 01:44:26 -0000
@@ -469,10 +469,8 @@
 :- pred traverse_goal(hlds_goal::in, hlds_goal::out, bool::out,
     intermod_info::in, intermod_info::out) is det.
 
-traverse_goal(conj(Goals0) - Info, conj(Goals) - Info, DoWrite, !Info) :-
-    traverse_list_of_goals(Goals0, Goals, DoWrite, !Info).
-traverse_goal(par_conj(Goals0) - Info, par_conj(Goals) - Info, DoWrite,
-        !Info) :-
+traverse_goal(conj(ConjType, Goals0) - Info, conj(ConjType, Goals) - Info,
+        DoWrite, !Info) :-
     traverse_list_of_goals(Goals0, Goals, DoWrite, !Info).
 traverse_goal(disj(Goals0) - Info, disj(Goals) - Info, DoWrite, !Info) :-
     traverse_list_of_goals(Goals0, Goals, DoWrite, !Info).
@@ -1577,7 +1575,7 @@
     (
         (
             % Pull the foreign code out of the goal.
-            Goal = conj(Goals) - _,
+            Goal = conj(plain_conj, Goals) - _,
             list__filter((pred(X::in) is semidet :-
                     X = foreign_proc(_, _, _, _, _, _) - _
                 ), Goals, [ForeignCodeGoal]),
Index: compiler/interval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/interval.m,v
retrieving revision 1.13
diff -u -b -r1.13 interval.m
--- compiler/interval.m	28 Nov 2005 04:11:43 -0000	1.13
+++ compiler/interval.m	24 Feb 2006 02:47:50 -0000
@@ -204,12 +204,9 @@
 
 %-----------------------------------------------------------------------------%
 
-build_interval_info_in_goal(conj(Goals) - _GoalInfo, !IntervalInfo, !Acc) :-
-    build_interval_info_in_conj(Goals, !IntervalInfo, !Acc).
-
-build_interval_info_in_goal(par_conj(Goals) - _GoalInfo, !IntervalInfo,
+build_interval_info_in_goal(conj(ConjType, Goals) - _GoalInfo, !IntervalInfo,
         !Acc) :-
-    build_interval_info_in_par_conj(Goals, !IntervalInfo, !Acc).
+    build_interval_info_in_conj(Goals, ConjType, !IntervalInfo, !Acc).
 
 build_interval_info_in_goal(disj(Goals) - GoalInfo, !IntervalInfo, !Acc) :-
     (
@@ -461,25 +458,17 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred build_interval_info_in_conj(list(hlds_goal)::in,
-    interval_info::in, interval_info::out, T::in, T::out) is det
-    <= build_interval_info_acc(T).
-
-build_interval_info_in_conj([], !IntervalInfo, !Acc).
-build_interval_info_in_conj([Goal | Goals], !IntervalInfo, !Acc) :-
-    build_interval_info_in_conj(Goals, !IntervalInfo, !Acc),
-    build_interval_info_in_goal(Goal, !IntervalInfo, !Acc).
-
-:- pred build_interval_info_in_par_conj(list(hlds_goal)::in,
+:- pred build_interval_info_in_conj(list(hlds_goal)::in, conj_type::in,
     interval_info::in, interval_info::out, T::in, T::out) is det
     <= build_interval_info_acc(T).
 
-build_interval_info_in_par_conj([], !IntervalInfo, !Acc).
-build_interval_info_in_par_conj([Goal | Goals], !IntervalInfo, !Acc) :-
+build_interval_info_in_conj([], _, !IntervalInfo, !Acc).
+build_interval_info_in_conj([Goal | Goals], ConjType, !IntervalInfo, !Acc) :-
     % XXX zs: I am not sure that passing interval_info from the first goal
-    % to the rest is OK. Maybe we should pass the initial interval_info to
-    % all the conjuncts, and then merge the resulting interval_infos.
-    build_interval_info_in_par_conj(Goals, !IntervalInfo, !Acc),
+    % to the rest is OK when ConjType = parallel_conj. Maybe we should pass
+    % the initial interval_info to all the conjuncts, and then merge the
+    % resulting interval_infos.
+    build_interval_info_in_conj(Goals, ConjType, !IntervalInfo, !Acc),
     build_interval_info_in_goal(Goal, !IntervalInfo, !Acc).
 
 :- pred build_interval_info_in_disj(list(hlds_goal)::in, maybe_needs_flush::in,
@@ -852,17 +841,10 @@
 
 record_decisions_in_goal(Goal0, Goal, !VarInfo, !VarRename, InsertMap,
         MaybeFeature) :-
-    Goal0 = conj(Goals0) - GoalInfo,
+    Goal0 = conj(ConjType, Goals0) - GoalInfo,
     record_decisions_in_conj(Goals0, Goals, !VarInfo, !VarRename,
-        InsertMap, MaybeFeature),
-    Goal = conj(Goals) - GoalInfo.
-
-record_decisions_in_goal(Goal0, Goal, !VarInfo, VarRename0, map__init,
-        InsertMap, MaybeFeature) :-
-    Goal0 = par_conj(Goals0) - GoalInfo,
-    record_decisions_in_par_conj(Goals0, Goals, !VarInfo, VarRename0,
-        InsertMap, MaybeFeature),
-    Goal = par_conj(Goals) - GoalInfo.
+        ConjType, InsertMap, MaybeFeature),
+    Goal = conj(ConjType, Goals) - GoalInfo.
 
 record_decisions_in_goal(Goal0,  Goal, !VarInfo, !VarRename, InsertMap,
         MaybeFeature) :-
@@ -940,7 +922,7 @@
         Reason0 = promise_purity(_, _),
         Reason = Reason0
     ;
-        Reason0 = promise_equivalent_solutions(_),
+        Reason0 = promise_solutions(_, _),
         Reason = Reason0
     ;
         Reason0 = commit(_),
@@ -1130,32 +1112,23 @@
 
 :- pred record_decisions_in_conj(list(hlds_goal)::in, list(hlds_goal)::out,
     var_info::in, var_info::out, rename_map::in, rename_map::out,
-    insert_map::in, maybe(goal_feature)::in) is det.
+    conj_type::in, insert_map::in, maybe(goal_feature)::in) is det.
 
-record_decisions_in_conj([], [], !VarInfo, !VarRename, _, _).
+record_decisions_in_conj([], [], !VarInfo, !VarRename, _, _, _).
 record_decisions_in_conj([Goal0 | Goals0], Goals, !VarInfo, !VarRename,
-        InsertMap, MaybeFeature) :-
-    record_decisions_in_goal(Goal0, Goal1, !VarInfo, !VarRename,
+        ConjType, InsertMap, MaybeFeature) :-
+    record_decisions_in_goal(Goal0, Goal, !VarInfo, !VarRename,
         InsertMap, MaybeFeature),
-    record_decisions_in_conj(Goals0, Goals1, !VarInfo, !VarRename,
-        InsertMap, MaybeFeature),
-    ( Goal1 = conj(SubGoals) - _ ->
-        Goals = list__append(SubGoals, Goals1)
+    record_decisions_in_conj(Goals0, TailGoals, !VarInfo, !VarRename,
+        ConjType, InsertMap, MaybeFeature),
+    (
+        Goal = conj(InnerConjType, SubGoals) - _,
+        ConjType = InnerConjType
+    ->
+        Goals = SubGoals ++ TailGoals
     ;
-        Goals = [Goal1 | Goals1]
+        Goals = [Goal | TailGoals]
     ).
-
-:- pred record_decisions_in_par_conj(list(hlds_goal)::in, list(hlds_goal)::out,
-    var_info::in, var_info::out, rename_map::in, insert_map::in,
-        maybe(goal_feature)::in) is det.
-
-record_decisions_in_par_conj([], [], !VarInfo, _, _, _).
-record_decisions_in_par_conj([Goal0 | Goals0], [Goal | Goals], !VarInfo,
-        VarRename0, InsertMap, MaybeFeature) :-
-    record_decisions_in_goal(Goal0, Goal, !VarInfo, VarRename0, _,
-        InsertMap, MaybeFeature),
-    record_decisions_in_par_conj(Goals0, Goals, !VarInfo, VarRename0,
-        InsertMap, MaybeFeature).
 
 :- pred record_decisions_in_disj(list(hlds_goal)::in, list(hlds_goal)::out,
     var_info::in, var_info::out, rename_map::in, list(insert_spec)::in,
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.110
diff -u -b -r1.110 lambda.m
--- compiler/lambda.m	23 Feb 2006 09:36:54 -0000	1.110
+++ compiler/lambda.m	24 Feb 2006 01:44:27 -0000
@@ -220,13 +220,9 @@
         process_unify_goal(XVar, Y, Mode, Unification, Context,
             GoalExpr, !Info)
     ;
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
         process_goal_list(Goals0, Goals, !Info),
-        GoalExpr = conj(Goals)
-    ;
-        GoalExpr0 = par_conj(Goals0),
-        process_goal_list(Goals0, Goals, !Info),
-        GoalExpr = par_conj(Goals)
+        GoalExpr = conj(ConjType, Goals)
     ;
         GoalExpr0 = disj(Goals0),
         process_goal_list(Goals0, Goals, !Info),
Index: compiler/lco.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.31
diff -u -b -r1.31 lco.m
--- compiler/lco.m	23 Feb 2006 09:36:54 -0000	1.31
+++ compiler/lco.m	24 Feb 2006 02:31:56 -0000
@@ -351,28 +351,32 @@
 
 lco_in_goal(Goal0 - GoalInfo, Goal - GoalInfo, !Info, ConstInfo) :-
     (
-        Goal0 = conj(Goals0),
+        Goal0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
         lco_in_conj(list__reverse(Goals0), [], bag__init, MaybeGoals,
             !Info, ConstInfo),
         (
             MaybeGoals = yes(Goals),
-            Goal = conj(Goals)
+                Goal = conj(plain_conj, Goals)
         ;
             MaybeGoals = no,
-            % If the top-level conjunction doesn't end with some unifications
-            % we can move before a recursive call, maybe it ends with a switch
-            % or if-then-else, some of whose arms fit that pattern.
+                % If the top-level conjunction doesn't end with some
+                % unifications we can move before a recursive call,
+                % maybe it ends with a switch or if-then-else, some of whose
+                % arms fit that pattern.
             ( list__split_last(Goals0, AllButLast, Last0) ->
                 lco_in_goal(Last0, Last, !Info, ConstInfo),
-                Goal = conj(AllButLast ++ [Last])
+                    Goal = conj(plain_conj, AllButLast ++ [Last])
             ;
                 Goal = Goal0
             )
         )
     ;
-        Goal0 = par_conj(_),
+            ConjType = parallel_conj,
         Goal = Goal0,
         !:Info = !.Info ^ permitted := not_permitted
+        )
     ;
         Goal0 = disj(Goals0),
         % There is no point in looking for tail calls in the non-last
@@ -847,12 +851,14 @@
 transform_variant_goal(ModuleInfo, VarToAddr, InstMap0,
         GoalExpr0 - GoalInfo, GoalExpr - GoalInfo) :-
     (
-        GoalExpr0 = conj(Goals0),
-        transform_variant_conj(ModuleInfo, VarToAddr, InstMap0, Goals0, Goals),
-        GoalExpr = conj(Goals)
+        GoalExpr0 = conj(ConjType, Goals0),
+        ( ConjType = parallel_conj ->
+            unexpected(this_file, "transform_variant_goal: parallel_conj")
     ;
-        GoalExpr0 = par_conj(_),
-        unexpected(this_file, "transform_variant_goal: par_conj")
+            transform_variant_conj(ModuleInfo, VarToAddr, InstMap0,
+                Goals0, Goals),
+            GoalExpr = conj(ConjType, Goals)
+        )
     ;
         GoalExpr0 = disj(Goals0),
         list__map(transform_variant_goal(ModuleInfo, VarToAddr, InstMap0),
@@ -908,7 +914,7 @@
     transform_variant_goal(ModuleInfo, VarToAddr, InstMap0, Goal0, Goal),
     update_instmap(Goal0, InstMap0, InstMap1),
     transform_variant_conj(ModuleInfo, VarToAddr, InstMap1, Goals0, Goals),
-    ( Goal = conj(SubConj) - _ ->
+    ( Goal = conj(plain_conj, SubConj) - _ ->
         Conj = SubConj ++ Goals
     ;
         Conj = [Goal | Goals]
@@ -936,7 +942,7 @@
     ;
         GroundingVarToAddr = [_ | _],
         list__map(make_store_goal(ModuleInfo), GroundingVarToAddr, StoreGoals),
-        GoalExpr = conj([GoalExpr0 - GoalInfo | StoreGoals])
+        GoalExpr = conj(plain_conj, [GoalExpr0 - GoalInfo | StoreGoals])
     ).
 
 :- pred is_grounding(module_info::in, instmap::in, instmap::in,
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.114
diff -u -b -r1.114 live_vars.m
--- compiler/live_vars.m	28 Nov 2005 04:11:43 -0000	1.114
+++ compiler/live_vars.m	24 Feb 2006 02:30:03 -0000
@@ -158,14 +158,16 @@
 	set(prog_var)::in, set(prog_var)::out,
 	set(prog_var)::in, set(prog_var)::out) is det <= stack_alloc_info(T).
 
-build_live_sets_in_goal_2(conj(Goals0), conj(Goals), GoalInfo, GoalInfo,
-		ResumeVars0, AllocData, !StackAlloc, !Liveness, !NondetLiveness) :-
-	build_live_sets_in_conj(Goals0, Goals, ResumeVars0, AllocData,
-		!StackAlloc, !Liveness, !NondetLiveness).
-
-build_live_sets_in_goal_2(par_conj(Goals0), par_conj(Goals),
+build_live_sets_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
 		GoalInfo0, GoalInfo, ResumeVars0, AllocData,
 		!StackAlloc, !Liveness, !NondetLiveness) :-
+    (
+        ConjType = plain_conj,
+        GoalInfo = GoalInfo0,
+        build_live_sets_in_conj(Goals0, Goals, ResumeVars0, AllocData,
+            !StackAlloc, !Liveness, !NondetLiveness)
+    ;
+        ConjType = parallel_conj,
 	goal_info_get_code_gen_nonlocals(GoalInfo0, NonLocals),
 	set__union(NonLocals, !.Liveness, LiveSet),
     % Since each parallel conjunct may be run on a different Mercury engine
@@ -176,7 +178,8 @@
 	NeedInParConj = need_in_par_conj(LiveSet),
 	record_par_conj(NeedInParConj, GoalInfo0, GoalInfo, !StackAlloc),
 	build_live_sets_in_par_conj(Goals0, Goals, ResumeVars0, AllocData,
-		!StackAlloc, !Liveness, !NondetLiveness).
+            !StackAlloc, !Liveness, !NondetLiveness)
+    ).
 
 build_live_sets_in_goal_2(disj(Goals0), disj(Goals), GoalInfo, GoalInfo,
 		ResumeVars0, AllocData, !StackAlloc, !Liveness, !NondetLiveness) :-
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.140
diff -u -b -r1.140 liveness.m
--- compiler/liveness.m	17 Nov 2005 15:57:20 -0000	1.140
+++ compiler/liveness.m	24 Feb 2006 02:30:25 -0000
@@ -334,15 +334,18 @@
     set(prog_var)::in, set(prog_var)::out, set(prog_var)::in,
     live_info::in) is det.
 
-detect_liveness_in_goal_2(conj(Goals0), conj(Goals), !Liveness, _, LiveInfo) :-
-    detect_liveness_in_conj(Goals0, Goals, !Liveness, LiveInfo).
-
-detect_liveness_in_goal_2(par_conj(Goals0), par_conj(Goals), !Liveness,
-        NonLocals, LiveInfo) :-
+detect_liveness_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
+        !Liveness, NonLocals, LiveInfo) :-
+    (
+        ConjType = plain_conj,
+        detect_liveness_in_conj(Goals0, Goals, !Liveness, LiveInfo)
+    ;
+        ConjType = parallel_conj,
     set__init(Union0),
     detect_liveness_in_par_conj(Goals0, Goals, !.Liveness, NonLocals,
         LiveInfo, Union0, Union),
-    set__union(Union, !Liveness).
+        set__union(Union, !Liveness)
+    ).
 
 detect_liveness_in_goal_2(disj(Goals0), disj(Goals), !Liveness,
         NonLocals, LiveInfo) :-
@@ -528,18 +531,20 @@
     hlds_goal_info::in, set(prog_var)::in, set(prog_var)::out,
     set(prog_var)::in, live_info::in) is det.
 
-detect_deadness_in_goal_2(conj(Goals0), conj(Goals), _, !Deadness, Liveness0,
-        LiveInfo) :-
-    detect_deadness_in_conj(Goals0, Goals, !Deadness, Liveness0, LiveInfo).
-
-detect_deadness_in_goal_2(par_conj(Goals0), par_conj(Goals), GoalInfo,
-        !Deadness, Liveness0, LiveInfo) :-
+detect_deadness_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
+        GoalInfo, !Deadness, Liveness0, LiveInfo) :-
+    (
+        ConjType = plain_conj,
+        detect_deadness_in_conj(Goals0, Goals, !Deadness, Liveness0, LiveInfo)
+    ;
+        ConjType = parallel_conj,
     liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo,
         _, CompletedNonLocals),
     set__init(Union0),
     detect_deadness_in_par_conj(Goals0, Goals, !.Deadness, Liveness0,
         CompletedNonLocals, LiveInfo, Union0, Union),
-    set__union(Union, !Deadness).
+        set__union(Union, !Deadness)
+    ).
 
 detect_deadness_in_goal_2(disj(Goals0), disj(Goals), GoalInfo, !Deadness,
         Liveness0, LiveInfo) :-
@@ -831,10 +836,8 @@
 update_liveness_expr(generic_call(_, _, _, _), _, _, !Liveness).
 update_liveness_expr(unify(_, _, _, _, _), _, _, !Liveness).
 update_liveness_expr(foreign_proc(_, _, _, _, _, _), _, _, !Liveness).
-update_liveness_expr(conj(Goals), _, LiveInfo, !Liveness) :-
-    update_liveness_conj(Goals, LiveInfo, !Liveness).
-update_liveness_expr(par_conj(Goals), _, LiveInfo, !Liveness) :-
-        % XXX do these need special treatment?
+update_liveness_expr(conj(_ConjType, Goals), _, LiveInfo, !Liveness) :-
+    % XXX Do parallel conjunctions need special treatment?
     update_liveness_conj(Goals, LiveInfo, !Liveness).
 update_liveness_expr(disj(Goals), _GoalInfo, LiveInfo, !Liveness) :-
     ( find_reachable_goal(Goals, Goal) ->
@@ -989,14 +992,16 @@
     ;
         !.GoalExpr = foreign_proc(_, _, _, _, _, _)
     ;
-        !.GoalExpr = conj(Goals0),
-        delay_death_conj(Goals0, Goals, !BornVars, !DelayedDead, VarSet),
-        !:GoalExpr = conj(Goals)
+        !.GoalExpr = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
+            delay_death_conj(Goals0, Goals, !BornVars, !DelayedDead, VarSet)
     ;
-        !.GoalExpr = par_conj(Goals0),
-        delay_death_conj(Goals0, Goals, !BornVars, !DelayedDead,
-            VarSet),
-        !:GoalExpr = par_conj(Goals)
+            ConjType = parallel_conj,
+            delay_death_par_conj(Goals0, Goals, !BornVars, !DelayedDead,
+                VarSet)
+        ),
+        !:GoalExpr = conj(ConjType, Goals)
     ;
         !.GoalExpr = disj(Goals0),
         delay_death_disj(Goals0, GoalDeaths, !.BornVars, !.DelayedDead,
@@ -1178,15 +1183,17 @@
     set(prog_var)::in, set(prog_var)::out, hlds_goal_info::in,
     live_info::in, set(prog_var)::in) is det.
 
-detect_resume_points_in_goal_2(conj(Goals0), conj(Goals), !Liveness, _,
-        LiveInfo, ResumeVars0) :-
+detect_resume_points_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
+        !Liveness, _, LiveInfo, ResumeVars0) :-
+    (
+        ConjType = plain_conj,
     detect_resume_points_in_conj(Goals0, Goals, !Liveness,
-        LiveInfo, ResumeVars0).
-
-detect_resume_points_in_goal_2(par_conj(Goals0), par_conj(Goals), !Liveness, _,
-        LiveInfo, ResumeVars0) :-
+            LiveInfo, ResumeVars0)
+    ;
+        ConjType = parallel_conj,
     detect_resume_points_in_par_conj(Goals0, Goals, !Liveness,
-        LiveInfo, ResumeVars0).
+            LiveInfo, ResumeVars0)
+    ).
 
 detect_resume_points_in_goal_2(disj(Goals0), disj(Goals), !Liveness, GoalInfo,
         LiveInfo, ResumeVars0) :-
Index: compiler/loop_inv.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/loop_inv.m,v
retrieving revision 1.28
diff -u -b -r1.28 loop_inv.m
--- compiler/loop_inv.m	23 Feb 2006 09:36:54 -0000	1.28
+++ compiler/loop_inv.m	24 Feb 2006 02:32:04 -0000
@@ -347,16 +347,17 @@
         IGCs).
 
 invariant_goal_candidates_2(PPId,
-        conj(Conjuncts)                              - _GoalInfo, IGCs) =
-    list__foldl(invariant_goal_candidates_2(PPId),
-                Conjuncts,
-                IGCs).
-
-invariant_goal_candidates_2(PPId,
-        par_conj(ParConjuncts)                       - _GoalInfo, IGCs) =
-    list__foldl(invariant_goal_candidates_keeping_path_candidates(PPId),
-                ParConjuncts,
-                IGCs).
+        conj(ConjType, Conjuncts)                    - _GoalInfo, IGCs0)
+        = IGCs :-
+    (
+        ConjType = plain_conj,
+        IGCs = list__foldl(invariant_goal_candidates_2(PPId), Conjuncts, IGCs0)
+    ;
+        ConjType = parallel_conj,
+        IGCs = list__foldl(
+            invariant_goal_candidates_keeping_path_candidates(PPId),
+            Conjuncts, IGCs0)
+    ).
 
 invariant_goal_candidates_2(PPId,
         disj(Disjuncts)                              - _GoalInfo, IGCs) =
@@ -381,7 +382,7 @@
 invariant_goal_candidates_2(PPId,
         if_then_else(_XVs, Cond, Then, Else)         - GoalInfo,  IGCs0)
         = IGCs :-
-    CondThenGoal = conj([Cond, Then]) - GoalInfo,
+    CondThenGoal = conj(plain_conj, [Cond, Then]) - GoalInfo,
     IGCs1        = invariant_goal_candidates_keeping_path_candidates(PPId,
                         CondThenGoal, IGCs0),
     ElseGoal     = Else,
@@ -857,11 +858,8 @@
         GoalInfo) =
     gen_aux_proc_handle_non_recursive_call(Info, ForeignProc - GoalInfo).
 
-gen_aux_proc_2(Info, conj(Conjuncts) - GoalInfo) =
-    conj(gen_aux_proc_list(Info, Conjuncts)) - GoalInfo.
-
-gen_aux_proc_2(Info, par_conj(Conjs) - GoalInfo) =
-    par_conj(gen_aux_proc_list(Info, Conjs)) - GoalInfo.
+gen_aux_proc_2(Info, conj(ConjType, Conjuncts) - GoalInfo) =
+    conj(ConjType, gen_aux_proc_list(Info, Conjuncts)) - GoalInfo.
 
 gen_aux_proc_2(Info, disj(Disjuncts) - GoalInfo) =
     disj(gen_aux_proc_list(Info, Disjuncts)) - GoalInfo.
@@ -906,10 +904,10 @@
 :- func gen_aux_proc_handle_non_recursive_call(gen_aux_proc_info, hlds_goal) =
     hlds_goal.
 
-gen_aux_proc_handle_non_recursive_call(Info, Goal0) = Goal :-
+gen_aux_proc_handle_non_recursive_call(Info, Goal0) =
     ( if   invariant_goal(Info ^ inv_goals, Goal0)
-      then true_goal(Goal)
-      else Goal = Goal0
+      then true_goal
+      else Goal0
     ).
 
 %-----------------------------------------------------------------------------%
@@ -974,12 +972,8 @@
     ForeignProc - GoalInfo.
 
 gen_out_proc_2(PPId, CallAux,
-        conj(Conjuncts)                                - GoalInfo) =
-    conj(list__map(gen_out_proc_2(PPId, CallAux), Conjuncts)) - GoalInfo.
-
-gen_out_proc_2(PPId, CallAux,
-        par_conj(ParConjuncts)                         - GoalInfo) =
-    par_conj(list__map(gen_out_proc_2(PPId, CallAux), ParConjuncts))
+        conj(ConjType, Conjuncts)                     - GoalInfo) =
+    conj(ConjType, list__map(gen_out_proc_2(PPId, CallAux), Conjuncts))
         - GoalInfo.
 
 gen_out_proc_2(PPId, CallAux,
@@ -1093,12 +1087,9 @@
     %
 uniquely_used_vars_2(_MI, unify(_LHS, _RHS, _UMode, _UKind, _) - _) = [].
 
-uniquely_used_vars_2(MI, conj(Conjuncts) - _) =
+uniquely_used_vars_2(MI, conj(_, Conjuncts) - _) =
     list__condense(list__map(uniquely_used_vars_2(MI), Conjuncts)).
 
-uniquely_used_vars_2(MI, par_conj(ParConjuncts) - _) =
-    list__condense(list__map(uniquely_used_vars_2(MI), ParConjuncts)).
-
 uniquely_used_vars_2(MI, disj(Disjuncts) - _) =
     list__condense(list__map(uniquely_used_vars_2(MI), Disjuncts)).
 
@@ -1187,8 +1178,8 @@
         Inputs = ( if UnifyRHS = var(RHS) then [LHS, RHS] else [LHS] )
     ).
 
-goal_inputs(_MI, conj(_) - _) = _ :-
-    unexpected(this_file, "goal_inputs/2: conj/1 in hlds_goal").
+goal_inputs(_MI, conj(_, _) - _) = _ :-
+    unexpected(this_file, "goal_inputs/2: conj/2 in hlds_goal").
 
 goal_inputs(_MI, switch(_, _, _) - _) = _ :-
     unexpected(this_file, "goal_inputs/2: switch/3 in hlds_goal").
@@ -1205,9 +1196,6 @@
 goal_inputs(_MI, if_then_else(_, _, _, _) - _) = _ :-
     unexpected(this_file, "goal_inputs/2: if_then_else/4 in hlds_goal").
 
-goal_inputs(_MI, par_conj(_) - _) = _ :-
-    unexpected(this_file, "goal_inputs/2: par_conj/2 in hlds_goal").
-
 goal_inputs(_MI, shorthand(_) - _) = _ :-
     unexpected(this_file, "goal_inputs/2: shorthand/1 in hlds_goal").
 
@@ -1270,8 +1258,8 @@
         Outputs = []
     ).
 
-goal_outputs(_MI, conj(_) - _) = _ :-
-    unexpected(this_file, "goal_outputs/2: conj/1 in hlds_goal").
+goal_outputs(_MI, conj(_, _) - _) = _ :-
+    unexpected(this_file, "goal_outputs/2: conj/2 in hlds_goal").
 
 goal_outputs(_MI, switch(_, _, _) - _) = _ :-
     unexpected(this_file, "goal_outputs/2: switch/3 in hlds_goal").
@@ -1287,9 +1275,6 @@
 
 goal_outputs(_MI, if_then_else(_, _, _, _) - _) = _ :-
     unexpected(this_file, "goal_outputs/2: if_then_else/4 in hlds_goal").
-
-goal_outputs(_MI, par_conj(_) - _) = _ :-
-    unexpected(this_file, "goal_outputs/2: par_conj/1 in hlds_goal").
 
 goal_outputs(_MI, shorthand(_) - _) = _ :-
     unexpected(this_file, "goal_outputs/2: shorthand/1 in hlds_goal").
Index: compiler/make_hlds_warn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_warn.m,v
retrieving revision 1.6
diff -u -b -r1.6 make_hlds_warn.m
--- compiler/make_hlds_warn.m	23 Feb 2006 09:36:56 -0000	1.6
+++ compiler/make_hlds_warn.m	24 Feb 2006 02:28:37 -0000
@@ -130,12 +130,7 @@
 
 warn_singletons_in_goal_2(Goal, _GoalInfo, QuantVars, VarSet, PredCallId,
         MI, !IO) :-
-    Goal = conj(Goals),
-    warn_singletons_in_goal_list(Goals, QuantVars, VarSet, PredCallId, MI,
-        !IO).
-warn_singletons_in_goal_2(Goal, _GoalInfo, QuantVars, VarSet, PredCallId,
-        MI, !IO) :-
-    Goal = par_conj(Goals),
+    Goal = conj(_ConjType, Goals),
     warn_singletons_in_goal_list(Goals, QuantVars, VarSet, PredCallId, MI,
         !IO).
 warn_singletons_in_goal_2(Goal, _GoalInfo, QuantVars, VarSet, PredCallId,
@@ -159,7 +154,7 @@
     %
     (
         ( Reason = exist_quant(Vars)
-        ; Reason = promise_equivalent_solutions(Vars)
+        ; Reason = promise_solutions(Vars, _)
         ),
         Vars = [_ | _]
     ->
Index: compiler/mark_static_terms.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mark_static_terms.m,v
retrieving revision 1.20
diff -u -b -r1.20 mark_static_terms.m
--- compiler/mark_static_terms.m	28 Nov 2005 04:11:45 -0000	1.20
+++ compiler/mark_static_terms.m	18 Feb 2006 05:04:48 -0000
@@ -71,10 +71,8 @@
 :- pred goal_expr_mark_static_terms(hlds_goal_expr::in, hlds_goal_expr::out,
     static_info::in, static_info::out) is det.
 
-goal_expr_mark_static_terms(conj(Goals0), conj(Goals), !SI) :-
-    conj_mark_static_terms(Goals0, Goals, !SI).
-
-goal_expr_mark_static_terms(par_conj(Goals0), par_conj(Goals), !SI) :-
+goal_expr_mark_static_terms(conj(ConjType, Goals0), conj(ConjType, Goals),
+        !SI) :-
     % It's OK to treat parallel conjunctions as if they were sequential here,
     % since if we mark any variables as static, the computation of those
     % variables will be done at compile time.
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.112
diff -u -b -r1.112 middle_rec.m
--- compiler/middle_rec.m	24 Feb 2006 01:41:50 -0000	1.112
+++ compiler/middle_rec.m	24 Feb 2006 02:30:37 -0000
@@ -62,16 +62,16 @@
     Case1 = case(ConsId1, Goal1),
     Case2 = case(ConsId2, Goal2),
     (
-        contains_only_builtins(Goal1),
+        contains_only_builtins(Goal1) = yes,
         contains_simple_recursive_call(Goal2, !.CI)
     ->
-        middle_rec__generate_switch(Var, ConsId1, Goal1, Goal2,
+        middle_rec_generate_switch(Var, ConsId1, Goal1, Goal2,
             GoalInfo, Instrs, !CI)
     ;
-        contains_only_builtins(Goal2),
+        contains_only_builtins(Goal2) = yes,
         contains_simple_recursive_call(Goal1, !.CI)
     ->
-        middle_rec__generate_switch(Var, ConsId2, Goal2, Goal1,
+        middle_rec_generate_switch(Var, ConsId2, Goal2, Goal1,
             GoalInfo, Instrs, !CI)
     ;
         fail
@@ -89,7 +89,7 @@
     is semidet.
 
 contains_simple_recursive_call(Goal - _, CodeInfo) :-
-    Goal = conj(Goals),
+    Goal = conj(plain_conj, Goals),
     contains_simple_recursive_call_conj(Goals, CodeInfo).
 
 :- pred contains_simple_recursive_call_conj(list(hlds_goal)::in, code_info::in)
@@ -97,15 +97,14 @@
 
 contains_simple_recursive_call_conj([Goal | Goals], CodeInfo) :-
     Goal = GoalExpr - _,
-    ( contains_only_builtins_expr(GoalExpr) ->
+    ( contains_only_builtins_expr(GoalExpr) = yes ->
         contains_simple_recursive_call_conj(Goals, CodeInfo)
     ;
         is_recursive_call(GoalExpr, CodeInfo),
-        contains_only_builtins_list(Goals)
+        contains_only_builtins_list(Goals) = yes
     ).
 
-:- pred is_recursive_call(hlds_goal_expr::in, code_info::in)
-    is semidet.
+:- pred is_recursive_call(hlds_goal_expr::in, code_info::in) is semidet.
 
 is_recursive_call(Goal, CodeInfo) :-
     Goal = call(CallPredId, CallProcId, _, BuiltinState, _, _),
@@ -115,72 +114,118 @@
     code_info__get_proc_id(CodeInfo, ProcId),
     ProcId = CallProcId.
 
-    % contains_only_builtins(G) is true if G is a leaf procedure,
+    % contains_only_builtins(G) returns `yes' if G is a leaf procedure,
     % i.e. control does not leave G to call another procedure, even
     % if that procedure is a complicated unification. It also does not contain
     % unifications that take the addresses of fields.
     %
-:- pred contains_only_builtins(hlds_goal::in) is semidet.
+:- func contains_only_builtins(hlds_goal) = bool.
 
-contains_only_builtins(Goal - _GoalInfo) :-
+contains_only_builtins(Goal - _GoalInfo) =
     contains_only_builtins_expr(Goal).
 
-:- pred contains_only_builtins_expr(hlds_goal_expr::in) is semidet.
+:- func contains_only_builtins_expr(hlds_goal_expr) = bool.
 
-contains_only_builtins_expr(conj(Goals)) :-
-    contains_only_builtins_list(Goals).
-contains_only_builtins_expr(disj(Goals)) :-
+contains_only_builtins_expr(conj(ConjType, Goals)) = OnlyBuiltins :-
+    (
+        ConjType = plain_conj,
+        OnlyBuiltins = contains_only_builtins_list(Goals)
+    ;
+        ConjType = parallel_conj,
+        OnlyBuiltins = no
+    ).
+contains_only_builtins_expr(disj(Goals)) =
     contains_only_builtins_list(Goals).
-contains_only_builtins_expr(switch(_Var, _Category, Cases)) :-
+contains_only_builtins_expr(switch(_Var, _Category, Cases)) =
     contains_only_builtins_cases(Cases).
-contains_only_builtins_expr(not(Goal)) :-
+contains_only_builtins_expr(not(Goal)) =
     contains_only_builtins(Goal).
-contains_only_builtins_expr(scope(_, Goal)) :-
+contains_only_builtins_expr(scope(_, Goal)) =
     contains_only_builtins(Goal).
-contains_only_builtins_expr(if_then_else(_Vars, Cond, Then, Else)) :-
-    contains_only_builtins(Cond),
-    contains_only_builtins(Then),
-    contains_only_builtins(Else).
-contains_only_builtins_expr(call(_, _, _, BuiltinState, _, _)) :-
-    BuiltinState = inline_builtin.
-contains_only_builtins_expr(unify(_, _, _, Uni, _)) :-
+contains_only_builtins_expr(if_then_else(_Vars, Cond, Then, Else))
+        = OnlyBuiltins :-
+    (
+        contains_only_builtins(Cond) = yes,
+        contains_only_builtins(Then) = yes,
+        contains_only_builtins(Else) = yes
+    ->
+        OnlyBuiltins = yes
+    ;
+        OnlyBuiltins = no
+    ).
+contains_only_builtins_expr(call(_, _, _, BuiltinState, _, _))
+        = OnlyBuiltins :-
+    (
+        BuiltinState = inline_builtin,
+        OnlyBuiltins = yes
+    ;
+        BuiltinState = out_of_line_builtin,
+        OnlyBuiltins = no
+        ;
+        BuiltinState = not_builtin,
+        OnlyBuiltins = no
+    ).
+contains_only_builtins_expr(unify(_, _, _, Uni, _)) = OnlyBuiltins :-
     % Complicated unifies are _non_builtin_
     (
-        Uni = assign(_, _)
+        Uni = assign(_, _),
+        OnlyBuiltins = yes
     ;
-        Uni = simple_test(_, _)
+        Uni = simple_test(_, _),
+        OnlyBuiltins = yes
     ;
         Uni = construct(_, _, _, _, _, _, SubInfo),
         (
-            SubInfo = no_construct_sub_info
+            SubInfo = no_construct_sub_info,
+            OnlyBuiltins = yes
+        ;
+            SubInfo = construct_sub_info(TakeAddressFields, _),
+            (
+                TakeAddressFields = no,
+                OnlyBuiltins = yes
         ;
-            SubInfo = construct_sub_info(no, _)
+                TakeAddressFields = yes(_),
+                OnlyBuiltins = no
+            )
         )
     ;
-        Uni = deconstruct(_, _, _, _, _, _)
+        Uni = deconstruct(_, _, _, _, _, _),
+        OnlyBuiltins = yes
+    ;
+        Uni = complicated_unify(_, _, _),
+        OnlyBuiltins = no
+    ).
+contains_only_builtins_expr(foreign_proc(_, _, _, _, _, _)) = no.
+contains_only_builtins_expr(generic_call(_, _, _, _)) = no.
+contains_only_builtins_expr(shorthand(_)) = no.
+
+:- func contains_only_builtins_cases(list(case)) = bool.
+
+contains_only_builtins_cases([]) = yes.
+contains_only_builtins_cases([case(_ConsId, Goal) | Cases]) = OnlyBuiltins :-
+    ( contains_only_builtins(Goal) = yes ->
+        OnlyBuiltins = contains_only_builtins_cases(Cases)
+    ;
+        OnlyBuiltins = no
     ).
 
-:- pred contains_only_builtins_cases(list(case)::in) is semidet.
-
-contains_only_builtins_cases([]).
-contains_only_builtins_cases([case(_ConsId, Goal) | Cases]) :-
-    contains_only_builtins(Goal),
-    contains_only_builtins_cases(Cases).
-
-:- pred contains_only_builtins_list(list(hlds_goal)::in) is semidet.
+:- func contains_only_builtins_list(list(hlds_goal)) = bool.
 
-contains_only_builtins_list([]).
-contains_only_builtins_list([Goal | Goals]) :-
-    contains_only_builtins(Goal),
-    contains_only_builtins_list(Goals).
+contains_only_builtins_list([]) = yes.
+contains_only_builtins_list([Goal | Goals]) = OnlyBuiltins :-
+    ( contains_only_builtins(Goal) = yes ->
+        OnlyBuiltins = contains_only_builtins_list(Goals)
+    ;
+        OnlyBuiltins = no
+    ).
 
 %---------------------------------------------------------------------------%
 
-:- pred middle_rec__generate_switch(prog_var::in, cons_id::in, hlds_goal::in,
+:- pred middle_rec_generate_switch(prog_var::in, cons_id::in, hlds_goal::in,
     hlds_goal::in, hlds_goal_info::in, code_tree::out,
     code_info::in, code_info::out) is semidet.
 
-middle_rec__generate_switch(Var, BaseConsId, Base, Recursive, SwitchGoalInfo,
+middle_rec_generate_switch(Var, BaseConsId, Base, Recursive, SwitchGoalInfo,
         Instrs, !CI) :-
     code_info__get_stack_slots(!.CI, StackSlots),
     code_info__get_varset(!.CI, VarSet),
@@ -347,12 +392,12 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- pred middle_rec__generate_downloop_test(list(instruction)::in, label::in,
+:- pred generate_downloop_test(list(instruction)::in, label::in,
     list(instruction)::out) is det.
 
-middle_rec__generate_downloop_test([], _, _) :-
+generate_downloop_test([], _, _) :-
     unexpected(this_file, "generate_downloop_test on empty list").
-middle_rec__generate_downloop_test([Instr0 | Instrs0], Target, Instrs) :-
+generate_downloop_test([Instr0 | Instrs0], Target, Instrs) :-
     ( Instr0 = if_val(Test, _OldTarget) - _Comment ->
         (
             Instrs0 = []
@@ -365,18 +410,18 @@
         code_util__neg_rval(Test, NewTest),
         Instrs = [if_val(NewTest, label(Target)) - "test on downward loop"]
     ;
-        middle_rec__generate_downloop_test(Instrs0, Target, Instrs1),
+        generate_downloop_test(Instrs0, Target, Instrs1),
         Instrs = [Instr0 | Instrs1]
     ).
 
 %---------------------------------------------------------------------------%
 
-:- pred middle_rec__split_rec_code(list(instruction)::in,
+:- pred split_rec_code(list(instruction)::in,
     list(instruction)::out, list(instruction)::out) is det.
 
-middle_rec__split_rec_code([], _, _) :-
+split_rec_code([], _, _) :-
     unexpected(this_file, "did not find call in split_rec_code").
-middle_rec__split_rec_code([Instr0 | Instrs1], Before, After) :-
+split_rec_code([Instr0 | Instrs1], Before, After) :-
     ( Instr0 = call(_, _, _, _, _, _) - _ ->
         (
             opt_util__skip_comments(Instrs1, Instrs2),
@@ -389,7 +434,7 @@
             unexpected(this_file, "split_rec_code: call not followed by label")
         )
     ;
-        middle_rec__split_rec_code(Instrs1, Before1, After),
+        split_rec_code(Instrs1, Before1, After),
         Before = [Instr0 | Before1]
     ).
 
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.170
diff -u -b -r1.170 ml_code_gen.m
--- compiler/ml_code_gen.m	24 Feb 2006 01:41:50 -0000	1.170
+++ compiler/ml_code_gen.m	24 Feb 2006 01:44:30 -0000
@@ -1941,19 +1941,15 @@
         Decls, Statements, !Info) :-
     ml_gen_negation(Goal, CodeModel, Context, Decls, Statements, !Info).
 
-ml_gen_goal_expr(conj(Goals), CodeModel, Context,
+ml_gen_goal_expr(conj(_ConjType, Goals), CodeModel, Context,
         Decls, Statements, !Info) :-
+    % XXX Currently we treat parallel conjunction the same as
+    % sequential conjunction -- parallelism is not yet implemented.
     ml_gen_conj(Goals, CodeModel, Context, Decls, Statements, !Info).
 
 ml_gen_goal_expr(disj(Goals), CodeModel, Context,
         Decls, Statements, !Info) :-
     ml_gen_disj(Goals, CodeModel, Context, Decls, Statements, !Info).
-
-ml_gen_goal_expr(par_conj(Goals), CodeModel, Context,
-        Decls, Statements, !Info) :-
-    % XXX currently we treat parallel conjunction the same as
-    % sequential conjunction -- parallelism is not yet implemented
-    ml_gen_conj(Goals, CodeModel, Context, Decls, Statements, !Info).
 
 ml_gen_goal_expr(generic_call(GenericCall, Vars, Modes, Detism), CodeModel,
         Context, Decls, Statements, !Info) :-
Index: compiler/mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_constraints.m,v
retrieving revision 1.21
diff -u -b -r1.21 mode_constraints.m
--- compiler/mode_constraints.m	23 Feb 2006 09:36:58 -0000	1.21
+++ compiler/mode_constraints.m	24 Feb 2006 02:23:03 -0000
@@ -349,7 +349,7 @@
     number_robdd_info::in, number_robdd_info::out) is det.
 
 number_robdd_variables_in_goal_2(InstGraph, _, _, NonLocals, Occurring,
-        conj(Goals0), conj(Goals), !RInfo) :-
+        conj(ConjType, Goals0), conj(ConjType, Goals), !RInfo) :-
     number_robdd_variables_in_goals(InstGraph, NonLocals, Occurring,
         Goals0, Goals, !RInfo).
 number_robdd_variables_in_goal_2(InstGraph, _, _, NonLocals, Occurring,
@@ -378,10 +378,6 @@
     number_robdd_variables_in_goal(InstGraph, NonLocals, OccElse,
         Else0, Else, !RInfo),
     Occurring = OccCond `set__union` OccThen `set__union` OccElse.
-number_robdd_variables_in_goal_2(InstGraph, _, _, NonLocals, Occurring,
-        par_conj(Goals0), par_conj(Goals), !RInfo) :-
-    number_robdd_variables_in_goals(InstGraph, NonLocals, Occurring,
-        Goals0, Goals, !RInfo).
 number_robdd_variables_in_goal_2(_, _, _, _, _, shorthand(_), _, !RInfo) :-
     unexpected(this_file, "number_robdd_variables_in_goal_2: shorthand").
 
@@ -1126,8 +1122,10 @@
     hlds_goal_expr::out, mode_constraint::in, mode_constraint::out,
     goal_constraints_info::in, goal_constraints_info::out) is det.
 
-goal_constraints_2(GoalPath, NonLocals, _, CanSucceed, conj(Goals0),
-        conj(Goals), !Constraint, !GCInfo) :-
+goal_constraints_2(GoalPath, NonLocals, _, CanSucceed, conj(ConjType, Goals0),
+        conj(ConjType, Goals), !Constraint, !GCInfo) :-
+    (
+        ConjType = plain_conj,
     multi_map__init(Usage0),
 
     Usage = list__foldl(func(G, U0) =
@@ -1149,7 +1147,11 @@
 
     % Generate the rest of the constraints.
     conj_constraints(no, KnownTrue, KnownFalse, GoalPath, Usage,
-        !Constraint, !GCInfo).
+            !Constraint, !GCInfo)
+    ;
+        ConjType = parallel_conj,
+        sorry(this_file, "goal_constraints_2: par_conj NYI")
+    ).
 
 goal_constraints_2(GoalPath, NonLocals, Vars, CanSucceed, disj(Goals0),
         disj(Goals), !Constraint, !GCInfo) :-
@@ -1351,8 +1353,6 @@
 
 goal_constraints_2(_,_,_,_,foreign_proc(_,_,_,_,_,_),_,_,_,_,_) :-
     sorry(this_file, "goal_constraints_2: foreign_proc NYI").
-goal_constraints_2(_,_,_,_,par_conj(_),_,_,_,_,_) :-
-    sorry(this_file, "goal_constraints_2: par_conj NYI").
 goal_constraints_2(_,_,_,_,shorthand(_),_,_,_,_,_) :-
     sorry(this_file, "goal_constraints_2: shorthand").
 
Index: compiler/mode_ordering.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_ordering.m,v
retrieving revision 1.9
diff -u -b -r1.9 mode_ordering.m
--- compiler/mode_ordering.m	23 Feb 2006 09:36:59 -0000	1.9
+++ compiler/mode_ordering.m	24 Feb 2006 02:23:14 -0000
@@ -176,8 +176,10 @@
     mode_ordering__info::in, mode_ordering__info::out) is det.
 
 mode_ordering__goal_2(Goal0, Goal, !GoalInfo, !MOI) :-
-    Goal0 = conj(Goals0),
-    Goal = conj(Goals),
+    Goal0 = conj(ConjType, Goals0),
+    Goal = conj(ConjType, Goals),
+    (
+        ConjType = plain_conj,
     list__map_foldl(mode_ordering__goal, Goals0, Goals1, !MOI),
     mode_ordering__conj(Goals1, Goals),
     union_mode_vars_sets(Goals, !GoalInfo),
@@ -186,7 +188,12 @@
         ConsVars `difference` !.GoalInfo ^ producing_vars,
     NeedVars = !.GoalInfo ^ need_visible_vars,
     !:GoalInfo = !.GoalInfo ^ need_visible_vars :=
-        NeedVars `difference` !.GoalInfo ^ make_visible_vars.
+            NeedVars `difference` !.GoalInfo ^ make_visible_vars
+    ;
+        ConjType = parallel_conj,
+        list__map_foldl(mode_ordering__goal, Goals0, Goals, !MOI),
+        union_mode_vars_sets(Goals, !GoalInfo)
+    ).
 
 mode_ordering__goal_2(Goal0, Goal, !GoalInfo, !MOI) :-
     Goal0 = call(PredId, _, Args, _, _, _),
@@ -322,12 +329,6 @@
 mode_ordering__goal_2(Goal0, _, !GoalInfo, !MOI) :-
     Goal0 = foreign_proc(_, _, _, _, _, _),
     unexpected(this_file, "mode_ordering__goal_2: pragma_foreign_code NYI").
-
-mode_ordering__goal_2(Goal0, Goal, !GoalInfo, !MOI) :-
-    Goal0 = par_conj(Goals0),
-    Goal = par_conj(Goals),
-    list__map_foldl(mode_ordering__goal, Goals0, Goals, !MOI),
-    union_mode_vars_sets(Goals, !GoalInfo).
 
 mode_ordering__goal_2(Goal0, _, !GoalInfo, !MOI) :-
     Goal0 = shorthand(_),
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.180
diff -u -b -r1.180 mode_util.m
--- compiler/mode_util.m	23 Feb 2006 09:36:59 -0000	1.180
+++ compiler/mode_util.m	24 Feb 2006 02:39:43 -0000
@@ -1008,16 +1008,18 @@
             VarTypes, InstMap, NonLocals, InstMapDelta, !RI)
     ).
 
-recompute_instmap_delta_2(Atomic, conj(Goals0), _, conj(Goals),
-        VarTypes, InstMap, InstMapDelta, !RI) :-
+recompute_instmap_delta_2(Atomic, conj(ConjType, Goals0), GoalInfo,
+        conj(ConjType, Goals), VarTypes, InstMap, InstMapDelta, !RI) :-
+    (
+        ConjType = plain_conj,
     recompute_instmap_delta_conj(Atomic, Goals0, Goals,
-        VarTypes, InstMap, InstMapDelta, !RI).
-
-recompute_instmap_delta_2(Atomic, par_conj(Goals0), GoalInfo,
-        par_conj(Goals), VarTypes, InstMap, InstMapDelta, !RI) :-
+            VarTypes, InstMap, InstMapDelta, !RI)
+    ;
+        ConjType = parallel_conj,
     goal_info_get_nonlocals(GoalInfo, NonLocals),
     recompute_instmap_delta_par_conj(Atomic, Goals0, Goals,
-        VarTypes, InstMap, NonLocals, InstMapDelta, !RI).
+            VarTypes, InstMap, NonLocals, InstMapDelta, !RI)
+    ).
 
 recompute_instmap_delta_2(Atomic, disj(Goals0), GoalInfo, disj(Goals),
         VarTypes, InstMap, InstMapDelta, !RI) :-
Index: compiler/modecheck_unify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.97
diff -u -b -r1.97 modecheck_unify.m
--- compiler/modecheck_unify.m	23 Feb 2006 09:36:59 -0000	1.97
+++ compiler/modecheck_unify.m	24 Feb 2006 01:44:32 -0000
@@ -114,7 +114,7 @@
         set__init(WaitingVars),
         mode_info_error(WaitingVars,
             purity_error_lambda_should_be_impure(AnyVars), !ModeInfo),
-        Unify = conj([])
+        Unify = conj(plain_conj, [])
     ;
         modecheck_unification_2(X, RHS, Unification0, UnifyContext,
             UnifyGoalInfo0, Unify, !ModeInfo, !IO)
@@ -195,7 +195,8 @@
             MaybeInitX = yes(InitGoal - InitGoalInfo),
             modes__compute_goal_instmap_delta(InstMap, Unify0,
                 UnifyGoalInfo0, UnifyGoalInfo, !ModeInfo),
-            Unify = conj([InitGoal - InitGoalInfo, Unify0 - UnifyGoalInfo])
+            Unify = conj(plain_conj,
+                [InitGoal - InitGoalInfo, Unify0 - UnifyGoalInfo])
         )
     ;
         set__list_to_set([X, Y], WaitingVars),
@@ -658,7 +659,7 @@
         Unification = construct(_, _, _, _, _, _, _),
         LiveX = dead
     ->
-        Goal = conj([])
+        Goal = conj(plain_conj, [])
     ;
         Det = failure
     ->
@@ -948,13 +949,13 @@
         Unification = assign(AssignTarget, AssignSource),
         mode_info_var_is_live(!.ModeInfo, AssignTarget, dead)
     ->
-        Unify = conj([]),
+        Unify = conj(plain_conj, []),
         record_optimize_away(GoalInfo, AssignTarget, AssignSource, !ModeInfo)
     ;
         Unification = simple_test(TestVar1, TestVar2),
         Det = det
     ->
-        Unify = conj([]),
+        Unify = conj(plain_conj, []),
         record_optimize_away(GoalInfo, TestVar1, TestVar2, !ModeInfo)
     ;
         Det = failure
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.324
diff -u -b -r1.324 modes.m
--- compiler/modes.m	23 Feb 2006 09:36:59 -0000	1.324
+++ compiler/modes.m	24 Feb 2006 02:23:22 -0000
@@ -988,7 +988,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having mode information.
-        true_goal(Goal1),
+        Goal1 = true_goal,
         InstMap = InstMap1
     ),
 
@@ -1035,7 +1035,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having mode information.
-        true_goal(Goal1)
+        Goal1 = true_goal
     ),
 
     % Don't lose the information added by the functor test above.
@@ -1257,15 +1257,13 @@
     compute_goal_instmap_delta(InstMap0, Goal, GoalInfo0, GoalInfo, !ModeInfo).
 
 compute_goal_instmap_delta(InstMap0, Goal, !GoalInfo, !ModeInfo) :-
-    ( Goal = conj([]) ->
-        %
-        % When modecheck_unify.m replaces a unification with a
-        % dead variable with `true', make sure the instmap_delta
-        % of the goal is empty. The code generator and
-        % mode_util__recompute_instmap_delta can be confused
-        % by references to the dead variable in the instmap_delta,
+    ( Goal = conj(plain_conj, []) ->
+        % When modecheck_unify.m replaces a unification with a dead variable
+        % with `true', make sure the instmap_delta of the goal is empty.
+        % The code generator and mode_util.recompute_instmap_delta can be
+        % confused by references to the dead variable in the instmap_delta,
         % resulting in calls to error/1.
-        %
+
         instmap_delta_init_reachable(DeltaInstMap),
         mode_info_set_instmap(InstMap0, !ModeInfo)
     ;
@@ -1275,18 +1273,21 @@
     ),
     goal_info_set_instmap_delta(DeltaInstMap, !GoalInfo).
 
-modecheck_goal_expr(conj(List0), GoalInfo0, Goal, !ModeInfo, !IO) :-
+modecheck_goal_expr(conj(ConjType, Goals0), GoalInfo0, Goal, !ModeInfo, !IO) :-
+    (
+        ConjType = plain_conj,
     mode_checkpoint(enter, "conj", !ModeInfo, !IO),
     (
-        List0 = [],         % for efficiency, optimize common case
-        Goal = conj([])
+            Goals0 = [],         % for efficiency, optimize common case
+            Goal = conj(plain_conj, [])
     ;
-        List0 = [_ | _],
-        modecheck_conj_list(List0, List, !ModeInfo, !IO),
-        conj_list_to_goal(List, GoalInfo0, Goal - _GoalInfo)
+            Goals0 = [_ | _],
+            modecheck_conj_list(Goals0, Goals, !ModeInfo, !IO),
+            conj_list_to_goal(Goals, GoalInfo0, Goal - _GoalInfo)
     ),
-    mode_checkpoint(exit, "conj", !ModeInfo, !IO).
-
+        mode_checkpoint(exit, "conj", !ModeInfo, !IO)
+    ;
+        ConjType = parallel_conj,
     % To modecheck a parallel conjunction, we modecheck each
     % conjunct independently (just like for disjunctions).
     % To make sure that we don't try to bind a variable more than
@@ -1312,14 +1313,14 @@
     % A stack of these structures is maintained to handle nested parallel
     % conjunctions properly.
     %
-modecheck_goal_expr(par_conj(List0), GoalInfo0, par_conj(List), !ModeInfo,
-        !IO) :-
     mode_checkpoint(enter, "par_conj", !ModeInfo, !IO),
     goal_info_get_nonlocals(GoalInfo0, NonLocals),
-    modecheck_par_conj_list(List0, List, NonLocals, InstMapNonlocalList,
+        modecheck_par_conj_list(Goals0, Goals, NonLocals, InstMapNonlocalList,
         !ModeInfo, !IO),
+        Goal = conj(parallel_conj, Goals),
     instmap__unify(NonLocals, InstMapNonlocalList, !ModeInfo),
-    mode_checkpoint(exit, "par_conj", !ModeInfo, !IO).
+        mode_checkpoint(exit, "par_conj", !ModeInfo, !IO)
+    ).
 
 modecheck_goal_expr(disj(Disjs0), GoalInfo0, Goal, !ModeInfo, !IO) :-
     mode_checkpoint(enter, "disj", !ModeInfo, !IO),
@@ -1367,7 +1368,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having mode information.
-        true_goal(Then1),
+        Then1 = true_goal,
         InstMapThen1 = InstMapCond
     ),
     mode_info_set_instmap(InstMap0, !ModeInfo),
@@ -1444,7 +1445,7 @@
             mode_info_get_instmap(!.ModeInfo, InstMap0),
             instmap__lookup_var(InstMap0, TermVar, InstOfVar),
             InstOfVar = free,
-            SubGoal0 = conj([UnifyTermGoal | UnifyArgGoals])
+            SubGoal0 = conj(plain_conj, [UnifyTermGoal | UnifyArgGoals])
                 - SubGoalInfo,
             % If TermVar created by an impure unification, which is
             % possible for solver types, it is possible for
@@ -1463,7 +1464,7 @@
             % algorithm delay it repeatedly.
 
             list__reverse([UnifyTermGoal | UnifyArgGoals], RevConj),
-            RevSubGoal0 = conj(RevConj) - SubGoalInfo,
+            RevSubGoal0 = conj(plain_conj, RevConj) - SubGoalInfo,
             mode_checkpoint(enter, "ground scope", !ModeInfo, !IO),
             modecheck_goal(RevSubGoal0, SubGoal, !ModeInfo, !IO),
             mode_checkpoint(exit, "ground scope", !ModeInfo, !IO),
@@ -1751,7 +1752,7 @@
         % and we end up repeating the process forever.
         mode_info_add_goals_live_vars(GoalList0, !ModeInfo),
         modecheck_conj_list_no_delay(GoalList0, GoalList, !ModeInfo, !IO),
-        Goal = conj(GoalList),
+        Goal = conj(plain_conj, GoalList),
         mode_info_set_checking_extra_goals(no, !ModeInfo),
         mode_info_set_may_change_called_proc(MayChangeCalledProc0, !ModeInfo)
     ;
@@ -2016,7 +2017,7 @@
     (
         % Recurse into conjunctions, in case there are any conjunctions
         % that have not been flattened.
-        Goal = conj(ConjGoals) - _
+        Goal = conj(plain_conj, ConjGoals) - _
     ->
         mode_info_add_goals_live_vars(ConjGoals, !ModeInfo)
     ;
@@ -2029,7 +2030,7 @@
     (
         % Recurse into conjunctions, in case there are any conjunctions
         % that have not been flattened.
-        Goal = conj(ConjGoals) - _
+        Goal = conj(plain_conj, ConjGoals) - _
     ->
         mode_info_remove_goals_live_vars(ConjGoals, !ModeInfo)
     ;
@@ -2051,7 +2052,7 @@
 modecheck_conj_list_2([Goal0 | Goals0], Goals, !ImpurityErrors, !ModeInfo,
         !IO) :-
     (
-        Goal0 = conj(ConjGoals) - _
+        Goal0 = conj(plain_conj, ConjGoals) - _
     ->
         list__append(ConjGoals, Goals0, Goals1),
         modecheck_conj_list_2(Goals1, Goals, !ImpurityErrors, !ModeInfo, !IO)
@@ -2158,7 +2159,7 @@
         % in the list of successfully scheduled goals.
         % We flatten out conjunctions if we can. They can arise
         % when Goal0 was a scope(from_ground_term, _) goal.
-        ( Goal = conj(SubGoals) - _ ->
+        ( Goal = conj(plain_conj, SubGoals) - _ ->
             Goals = ScheduledSolverGoals ++ SubGoals ++ Goals2
         ;
             Goals = ScheduledSolverGoals ++ [Goal | Goals2]
@@ -2448,28 +2449,17 @@
         !CandidateVars),
     !:NonFree = set__union(NonFreeThen, NonFreeElse).
 
-candidate_init_vars_3(ModeInfo, Goal, !NonFree, !CandidateVars) :-
-        % A parallel conjunction.
-        %
-    Goal = par_conj(Goals) - _GoalInfo,
-    candidate_init_vars_2(ModeInfo, Goals, !NonFree, !CandidateVars).
-
 candidate_init_vars_3(ModeInfo, Goal0, !NonFree, !CandidateVars) :-
-        % An existentially quantified goal.
-        %
     Goal0 = scope(_, Goal) - _GoalInfo,
     candidate_init_vars_3(ModeInfo, Goal, !NonFree, !CandidateVars).
 
 candidate_init_vars_3(ModeInfo, Goal, !NonFree, !CandidateVars) :-
-        % A conjunction.
-        %
-    Goal = conj(Goals) - _GoalInfo,
+    Goal = conj(_ConjType, Goals) - _GoalInfo,
     candidate_init_vars_2(ModeInfo, Goals, !NonFree, !CandidateVars).
 
 candidate_init_vars_3(ModeInfo, Goal, !NonFree, !CandidateVars) :-
-        % XXX Is the determinism field of a generic_call
-        % valid at this point?  Determinism analysis is run after
-        % mode analysis.
+        % XXX Is the determinism field of a generic_call valid at this point?
+        % Determinism analysis is run after mode analysis.
         %
         % We assume that generic calls are deterministic.
         % The modes field of higher_order calls is junk until
@@ -2502,7 +2492,8 @@
     candidate_init_vars_call(ModeInfo, Args, ArgModes,
         !NonFree, !CandidateVars).
 
-    % Filter pred succeeding if a variable does not have a solver type.
+    % This filter pred succeeds if the given variable does not have
+    % a solver type.
     %
 :- pred non_solver_var(module_info::in, vartypes::in, prog_var::in) is semidet.
 
@@ -2510,8 +2501,7 @@
     VarType = VarTypes ^ det_elem(Var),
     not type_util__type_is_solver_type(ModuleInfo, VarType).
 
-    % Update !NonFree and !CandidateVars given the args and modes for
-    % a call.
+    % Update !NonFree and !CandidateVars given the args and modes for a call.
     %
 :- pred candidate_init_vars_call(mode_info::in,
     list(prog_var)::in, list(mer_mode)::in,
@@ -2566,16 +2556,14 @@
 modecheck_delayed_goals_eager(DelayedGoals0, DelayedGoals, Goals,
         !ImpurityErrors, !ModeInfo, !IO) :-
     (
-            % There are no unscheduled goals, so we don't
-            % need to do anything.
+            % There are no unscheduled goals, so we don't need to do anything.
             %
         DelayedGoals0 = [],
         DelayedGoals  = [],
         Goals         = []
     ;
-            % There are some unscheduled goals.  See if
-            % allowing extra initialisation calls (for
-            % a single goal) makes a difference.
+            % There are some unscheduled goals. See if allowing extra
+            % initialisation calls (for a single goal) makes a difference.
             %
         DelayedGoals0 = [_ | _],
 
@@ -2599,8 +2587,8 @@
         (
             length(DelayedGoals1) < length(DelayedGoals0)
         ->
-                % We scheduled some goals.  Keep going
-                % until we flounder or succeed.
+                % We scheduled some goals. Keep going until we either
+                % flounder or succeed.
                 %
             modecheck_delayed_goals_eager(DelayedGoals1, DelayedGoals,
                 Goals2, !ImpurityErrors, !ModeInfo, !IO),
@@ -2616,14 +2604,14 @@
 hlds_goal_from_delayed_goal(delayed_goal(_WaitingVars, _ModeError, Goal)) =
     Goal.
 
-    % Check whether there are any delayed goals (other than 
-    % unifications) at the point where we are about to schedule an impure goal.
-    % If so, that is an error. Headvar unifications are allowed to be delayed
-    % because in the case of output arguments, they cannot be scheduled
-    % until the variable value is known. If headvar unifications couldn't be
-    % delayed past impure goals, impure predicates wouldn't be able to have
-    % outputs! (Note that we first try to schedule any delayed solver goals
-    % waiting for initialisation.)
+    % Check whether there are any delayed goals (other than unifications)
+    % at the point where we are about to schedule an impure goal. If so,
+    % that is an error. Headvar unifications are allowed to be delayed
+    % because in the case of output arguments, they cannot be scheduled until
+    % the variable value is known. If headvar unifications couldn't be delayed
+    % past impure goals, impure predicates wouldn't be able to have outputs!
+    % (Note that we first try to schedule any delayed solver goals waiting
+    % for initialisation.)
     %
 :- pred check_for_impurity_error(hlds_goal::in, list(hlds_goal)::out,
     impurity_errors::in, impurity_errors::out,
@@ -2683,7 +2671,7 @@
 
     % Given an association list of Vars - Goals,
     % combine all the Vars together into a single set.
-
+    %
 :- pred get_all_waiting_vars(list(delayed_goal)::in, set(prog_var)::out)
     is det.
 
@@ -2702,7 +2690,6 @@
     is det.
 
 redelay_goals([], DelayInfo, DelayInfo).
-
 redelay_goals([DelayedGoal | DelayedGoals], DelayInfo0, DelayInfo) :-
     DelayedGoal = delayed_goal(_WaitingVars, ModeErrorInfo, Goal),
     delay_info__delay_goal(DelayInfo0, ModeErrorInfo, Goal, DelayInfo1),
@@ -2746,7 +2733,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having mode information.
-        true_goal(Goal1),
+        Goal1 = true_goal,
         InstMap = InstMap1
     ),
 
@@ -2853,13 +2840,12 @@
 :- pred modecheck_var_is_live(prog_var::in, is_live::in, bool::in,
     mode_info::in, mode_info::out) is det.
 
-    % `live' means possibly used later on, and
-    % `dead' means definitely not used later on.
-    % If you don't need an exact match, then
-    % the only time you get an error is if you pass a variable
-    % which is live to a predicate that expects the variable to
-    % be dead; the predicate may use destructive update to clobber
-    % the variable, so we must be sure that it is dead after the call.
+    % `live' means possibly used later on, and `dead' means definitely not used
+    % later on. If you don't need an exact match, then the only time you get
+    % an error is if you pass a variable which is live to a predicate
+    % that expects the variable to be dead; the predicate may use destructive
+    % update to clobber the variable, so we must be sure that it is dead
+    % after the call.
     %
 modecheck_var_is_live(VarId, ExpectedIsLive, NeedExactMatch, !ModeInfo) :-
     mode_info_var_is_live(!.ModeInfo, VarId, VarIsLive),
@@ -2876,9 +2862,8 @@
 
 %-----------------------------------------------------------------------------%
 
-    % Given a list of variables and a list of initial insts, ensure
-    % that the inst of each variable matches the corresponding initial
-    % inst.
+    % Given a list of variables and a list of initial insts, ensure that
+    % the inst of each variable matches the corresponding initial inst.
     %
 modecheck_var_has_inst_list(Vars, Insts, NeedEaxctMatch, ArgNum, Subst,
         !ModeInfo) :-
@@ -2946,8 +2931,8 @@
 
 :- pred modecheck_set_var_inst_list_2(list(prog_var)::in, list(mer_inst)::in,
     list(mer_inst)::in, int::in, list(prog_var)::out,
-    extra_goals::in, extra_goals::out,
-    mode_info::in, mode_info::out) is semidet.
+    extra_goals::in, extra_goals::out, mode_info::in, mode_info::out)
+    is semidet.
 
 modecheck_set_var_inst_list_2([], [], [], _, [], !ExtraGoals, !ModeInfo).
 modecheck_set_var_inst_list_2([Var0 | Vars0], [InitialInst | InitialInsts],
@@ -2969,7 +2954,7 @@
     mode_info_get_instmap(!.ModeInfo, InstMap0),
     ( instmap__is_reachable(InstMap0) ->
         % The new inst must be computed by unifying the
-        % old inst and the proc's final inst
+        % old inst and the proc's final inst.
         instmap__lookup_var(InstMap0, Var0, VarInst0),
         handle_implied_mode(Var0, VarInst0, InitialInst, Var, !ExtraGoals,
             !ModeInfo),
@@ -2993,7 +2978,7 @@
     mode_info_get_instmap(!.ModeInfo, InstMap0),
     ( instmap__is_reachable(InstMap0) ->
         % The new inst must be computed by unifying the
-        % old inst and the proc's final inst
+        % old inst and the proc's final inst.
         instmap__lookup_var(InstMap0, Var0, Inst0),
         mode_info_get_module_info(!.ModeInfo, ModuleInfo0),
         (
@@ -3009,8 +2994,8 @@
         mode_info_get_var_types(!.ModeInfo, VarTypes),
         map__lookup(VarTypes, Var0, Type),
         (
-            % if the top-level inst of the variable is not_reached,
-            % then the instmap as a whole must be unreachable
+            % If the top-level inst of the variable is not_reached,
+            % then the instmap as a whole must be unreachable.
             inst_expand(ModuleInfo, Inst, not_reached)
         ->
             instmap__init_unreachable(InstMap),
@@ -3034,15 +3019,12 @@
             % then we need to report an error...
             mode_info_var_is_locked(!.ModeInfo, Var0, Reason0),
             \+ (
-                % ...unless the goal is a unification and the
-                % var was unified with something no more
-                % instantiated than itself.
-                % This allows for the case of `any = free', for
-                % example. The call to
-                % inst_matches_binding, above will fail for the
-                % var with mode `any >> any' however, it should
-                % be allowed because it has only been unified
-                % with a free variable.
+                % ...unless the goal is a unification and the var was unified
+                % with something no more instantiated than itself. This allows
+                % for the case of `any = free', for example. The call to
+                % inst_matches_binding, above will fail for the var with
+                % mode `any >> any' however, it should be allowed because
+                % it has only been unified with a free variable.
                 MaybeUInst = yes(UInst),
                 inst_is_at_least_as_instantiated(Inst, UInst, Type,
                     ModuleInfo),
@@ -3116,15 +3098,14 @@
 
         Var = Var0,
 
-        % If the variable's type is not a solver type (in
-        % which case inst `any' means the same as inst
-        % `ground') then this is an implied mode that we
+        % If the variable's type is not a solver type (in which case inst `any'
+        % means the same as inst `ground') then this is an implied mode that we
         % don't yet know how to handle.
         %
-        % If the variable's type is a solver type then we need to
-        % insert a call to the solver type's initialisation predicate.
-        % (To avoid unnecessary complications, we avoid doing this if
-        % there are any mode errors recorded at this point.)
+        % If the variable's type is a solver type then we need to insert a call
+        % to the solver type's initialisation predicate. (To avoid unnecessary
+        % complications, we avoid doing this if there are any mode errors
+        % recorded at this point.)
 
         mode_info_get_context(!.ModeInfo, Context),
         mode_info_get_mode_context(!.ModeInfo, ModeContext),
@@ -3142,7 +3123,7 @@
             insert_extra_initialisation_call(Var, VarType, InitialInst,
                 Context, CallUnifyContext, !ExtraGoals, !ModeInfo)
         ;
-            % If the type is a type variable, or isn't a solver type
+            % If the type is a type variable, or isn't a solver type,
             % then give up.
             set__singleton_set(WaitingVars, Var0),
             mode_info_error(WaitingVars,
Index: compiler/ordering_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ordering_mode_constraints.m,v
retrieving revision 1.3
diff -u -b -r1.3 ordering_mode_constraints.m
--- compiler/ordering_mode_constraints.m	10 Feb 2006 03:40:55 -0000	1.3
+++ compiler/ordering_mode_constraints.m	24 Feb 2006 02:23:30 -0000
@@ -337,7 +337,10 @@
 :- pred goal_expr_reordering(pred_id::in, mc_var_map::in, mc_bindings::in,
     hlds_goal_expr::in, hlds_goal_expr::out) is semidet.
 
-goal_expr_reordering(PredId, VarMap, Bindings, conj(Goals0), conj(Goals)) :-
+goal_expr_reordering(PredId, VarMap, Bindings, conj(ConjType, Goals0),
+        conj(ConjType, Goals)) :-
+    (
+        ConjType = plain_conj,
     % Build constraints for this conjunction.
     make_conjuncts_nonlocal_repvars(PredId, Goals0, RepVarMap),
     conjunct_ordering_constraints(VarMap, Bindings, RepVarMap,
@@ -348,7 +351,11 @@
     list.map(list.index1_det(Goals0), Order, Goals1),
 
     % Then recurse on the reordered goals
-    list.map(goal_reordering(PredId, VarMap, Bindings), Goals1, Goals).
+        list.map(goal_reordering(PredId, VarMap, Bindings), Goals1, Goals)
+    ;
+        ConjType = parallel_conj,
+        list.map(goal_reordering(PredId, VarMap, Bindings), Goals0, Goals)
+    ).
 
     % goal_expr_reordering for atomic goals, and ones that shouldn't
     % exist yet.
@@ -387,10 +394,6 @@
     goal_reordering(PredId, VarMap, Bindings, Then0, Then),
     goal_reordering(PredId, VarMap, Bindings, Else0, Else).
 
-goal_expr_reordering(PredId, VarMap, Bindings, par_conj(Goals0),
-        par_conj(Goals)) :-
-    list.map(goal_reordering(PredId, VarMap, Bindings), Goals0, Goals).
-
 %-----------------------------------------------------------------------------%
 
     % ordering_init(N) creates a new ordering constraint system for
@@ -792,7 +795,7 @@
     ).
 
 dump_goal_expr_goal_paths(Indent, GoalExpr, !IO) :-
-    GoalExpr = conj(Goals),
+    GoalExpr = conj(_, Goals),
     list.foldl(dump_goal_goal_paths(Indent), Goals, !IO).
 
 dump_goal_expr_goal_paths(Indent, GoalExpr, !IO) :-
@@ -810,10 +813,6 @@
 dump_goal_expr_goal_paths(Indent, GoalExpr, !IO) :-
     GoalExpr = if_then_else(_, CondGoal, ThenGoal, ElseGoal),
     Goals = [CondGoal, ThenGoal, ElseGoal],
-    list.foldl(dump_goal_goal_paths(Indent), Goals, !IO).
-
-dump_goal_expr_goal_paths(Indent, GoalExpr, !IO) :-
-    GoalExpr = par_conj(Goals),
     list.foldl(dump_goal_goal_paths(Indent), Goals, !IO).
 
 %-----------------------------------------------------------------------------%
Index: compiler/pd_cost.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pd_cost.m,v
retrieving revision 1.26
diff -u -b -r1.26 pd_cost.m
--- compiler/pd_cost.m	17 Nov 2005 15:57:27 -0000	1.26
+++ compiler/pd_cost.m	18 Feb 2006 06:06:29 -0000
@@ -53,10 +53,7 @@
 
 %-----------------------------------------------------------------------------%
 
-pd_cost__goal(conj(Goals) - _, Cost) :-
-    pd_cost__goals(Goals, 0, Cost).
-
-pd_cost__goal(par_conj(Goals) - _, Cost) :-
+pd_cost__goal(conj(_, Goals) - _, Cost) :-
     pd_cost__goals(Goals, 0, Cost).
 
 pd_cost__goal(disj(Goals) - _, Cost) :-
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.291
diff -u -b -r1.291 polymorphism.m
--- compiler/polymorphism.m	24 Feb 2006 01:41:52 -0000	1.291
+++ compiler/polymorphism.m	24 Feb 2006 01:44:34 -0000
@@ -993,7 +993,7 @@
 
 assign_var(Var1, Var2, Goal) :-
     ( Var1 = Var2 ->
-        true_goal(Goal)
+        Goal = true_goal
     ;
         term__context_init(Context),
         create_atomic_complicated_unification(Var1, var(Var2), Context,
@@ -1071,13 +1071,9 @@
 
     % The rest of the clauses just process goals recursively.
 process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
-    GoalExpr = conj(Goals0),
+    GoalExpr = conj(ConjType, Goals0),
     process_goal_list(Goals0, Goals, !Info),
-    Goal = conj(Goals) - GoalInfo.
-process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
-    GoalExpr = par_conj(Goals0),
-    process_goal_list(Goals0, Goals, !Info),
-    Goal = par_conj(Goals) - GoalInfo.
+    Goal = conj(ConjType, Goals) - GoalInfo.
 process_goal_expr(GoalExpr, GoalInfo, Goal, !Info) :-
     GoalExpr = disj(Goals0),
     process_goal_list(Goals0, Goals, !Info),
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.94
diff -u -b -r1.94 post_typecheck.m
--- compiler/post_typecheck.m	23 Feb 2006 09:37:01 -0000	1.94
+++ compiler/post_typecheck.m	24 Feb 2006 01:44:34 -0000
@@ -1062,7 +1062,7 @@
         ConstructRestrictNonLocals, [TermOutputVar | ConstructArgs],
         UnifyContext, ConstructGoal),
 
-    Conj = conj([DeconstructGoal, ConstructGoal]) - OldGoalInfo,
+    Conj = conj(plain_conj, [DeconstructGoal, ConstructGoal]) - OldGoalInfo,
 
     % Make mode analysis treat the translated access function
     % as an atomic goal.
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.42
diff -u -b -r1.42 prog_rep.m
--- compiler/prog_rep.m	23 Feb 2006 09:37:03 -0000	1.42
+++ compiler/prog_rep.m	24 Feb 2006 01:44:35 -0000
@@ -129,12 +129,13 @@
     instmap::in, prog_rep_info::in, 
     stack_layout_info::in, stack_layout_info::out, list(int)::out) is det.
 
-goal_expr_to_byte_list(conj(Goals), _, InstMap0, Info, !StackInfo, Bytes) :-
+goal_expr_to_byte_list(conj(ConjType, Goals), _, InstMap0, Info, !StackInfo,
+        Bytes) :-
+    expect(unify(ConjType, plain_conj), this_file,
+        "non-plain conjunction and declarative debugging"),
     conj_to_byte_list(Goals, InstMap0, Info, !StackInfo, ConjBytes),
     Bytes = [goal_type_to_byte(goal_conj)] ++
         length_to_byte_list(Goals) ++ ConjBytes.
-goal_expr_to_byte_list(par_conj(_), _, _, _, !StackInfo, _) :-
-    sorry("prog_rep", "parallel conjunctions and declarative debugging").
 goal_expr_to_byte_list(disj(Goals), _, InstMap0, Info, !StackInfo, Bytes) :-
     disj_to_byte_list(Goals, InstMap0, Info, !StackInfo, DisjBytes),
     Bytes = [goal_type_to_byte(goal_disj)] ++
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.88
diff -u -b -r1.88 purity.m
--- compiler/purity.m	23 Feb 2006 09:37:03 -0000	1.88
+++ compiler/purity.m	24 Feb 2006 02:23:49 -0000
@@ -445,9 +445,8 @@
 :- pred compute_expr_purity(hlds_goal_expr::in, hlds_goal_expr::out,
     hlds_goal_info::in, purity::out, purity_info::in, purity_info::out) is det.
 
-compute_expr_purity(conj(Goals0), conj(Goals), _, Purity, !Info) :-
-    compute_goals_purity(Goals0, Goals, purity_pure, Purity, !Info).
-compute_expr_purity(par_conj(Goals0), par_conj(Goals), _, Purity, !Info) :-
+compute_expr_purity(conj(ConjType, Goals0), conj(ConjType, Goals), _, Purity,
+        !Info) :-
     compute_goals_purity(Goals0, Goals, purity_pure, Purity, !Info).
 compute_expr_purity(Goal0, Goal, GoalInfo, ActualPurity, !Info) :-
     Goal0 = call(PredId0, ProcId, Vars, BIState, UContext, Name0),
@@ -581,7 +580,7 @@
         !:Info = !.Info ^ implicit_purity := ImplicitPurity0,
         Purity = PromisedPurity
     ;
-        Reason = promise_equivalent_solutions(_),
+        Reason = promise_solutions(_, _),
         compute_goal_purity(Goal0, Goal, Purity, !Info)
     ;
         Reason = commit(_),
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.100
diff -u -b -r1.100 quantification.m
--- compiler/quantification.m	23 Feb 2006 09:37:03 -0000	1.100
+++ compiler/quantification.m	24 Feb 2006 02:29:31 -0000
@@ -313,7 +313,7 @@
         Reason1 = Reason0,
         Vars0 = []
     ;
-        Reason0 = promise_equivalent_solutions(_),
+        Reason0 = promise_solutions(_, _),
         Reason1 = Reason0,
         Vars0 = []
     ;
@@ -353,10 +353,10 @@
             Reason1 = promise_purity(_, _),
             Reason = Reason1
         ;
-            Reason1 = promise_equivalent_solutions(PromiseVars0),
+            Reason1 = promise_solutions(PromiseVars0, Kind),
             goal_util__rename_var_list(no, RenameMap,
                 PromiseVars0, PromiseVars),
-            Reason = promise_equivalent_solutions(PromiseVars)
+            Reason = promise_solutions(PromiseVars, Kind)
         ;
             Reason1 = commit(_),
             Reason = Reason1
@@ -379,14 +379,9 @@
     Expr = scope(Reason, Goal).
 
 implicitly_quantify_goal_2(Expr0, Expr, _, !Info) :-
-    Expr0 = conj(Goals0),
+    Expr0 = conj(ConjType, Goals0),
     implicitly_quantify_conj(Goals0, Goals, !Info),
-    Expr = conj(Goals).
-
-implicitly_quantify_goal_2(Expr0, Expr, _, !Info) :-
-    Expr0 = par_conj(Goals0),
-    implicitly_quantify_conj(Goals0, Goals, !Info),
-    Expr = par_conj(Goals).
+    Expr = conj(ConjType, Goals).
 
 implicitly_quantify_goal_2(Expr0, Expr, _, !Info) :-
     Expr0 = disj(Goals0),
@@ -622,16 +617,16 @@
     set_goal_nonlocals(NonLocalVars, GoalInfo1, GI, !Info),
     NotLHS = not(LHS) - LHS_GI,
     NotRHS = not(RHS) - RHS_GI,
-    ForwardsImplication = not(conj([LHS, NotRHS]) - GI) - GI,
+    ForwardsImplication = not(conj(plain_conj, [LHS, NotRHS]) - GI) - GI,
 
     % Rename apart the local variables of the goals we've just duplicated.
-    ReverseImplication0 = not(conj([RHS, NotLHS]) - GI) - GI,
+    ReverseImplication0 = not(conj(plain_conj, [RHS, NotLHS]) - GI) - GI,
     goal_vars_bitset(NonLocalsToRecompute, ReverseImplication0, GoalVars),
     difference(GoalVars, NonLocalVars, RenameVars),
     rename_apart(RenameVars, _, ReverseImplication0, ReverseImplication,
         !Info),
 
-    Goal = conj([ForwardsImplication, ReverseImplication]).
+    Goal = conj(plain_conj, [ForwardsImplication, ReverseImplication]).
 
 :- pred implicitly_quantify_atomic_goal(list(prog_var)::in,
     quant_info::in, quant_info::out) is det.
@@ -968,10 +963,12 @@
 goal_vars_2(_, call(_, _, ArgVars, _, _, _), !Set, !LambdaSet) :-
     insert_list(!.Set, ArgVars, !:Set).
 
-goal_vars_2(NonLocalsToRecompute, conj(Goals), !Set, !LambdaSet) :-
-    goal_list_vars_2(NonLocalsToRecompute, Goals, !Set, !LambdaSet).
-
-goal_vars_2(NonLocalsToRecompute, par_conj(Goals), !Set, !LambdaSet) :-
+goal_vars_2(NonLocalsToRecompute, conj(ConjType, Goals), !Set, !LambdaSet) :-
+    (
+        ConjType = plain_conj
+    ;
+        ConjType = parallel_conj
+    ),
     goal_list_vars_2(NonLocalsToRecompute, Goals, !Set, !LambdaSet).
 
 goal_vars_2(NonLocalsToRecompute, disj(Goals), !Set, !LambdaSet) :-
@@ -992,7 +989,7 @@
     ;
         Reason = promise_purity(_, _)
     ;
-        Reason = promise_equivalent_solutions(Vars),
+        Reason = promise_solutions(Vars, _Kind),
         insert_list(!.Set, Vars, !:Set)
     ;
         Reason = commit(_)
Index: compiler/saved_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.57
diff -u -b -r1.57 saved_vars.m
--- compiler/saved_vars.m	6 Dec 2005 06:26:07 -0000	1.57
+++ compiler/saved_vars.m	24 Feb 2006 02:30:56 -0000
@@ -109,20 +109,20 @@
 
 saved_vars_in_goal(GoalExpr0 - GoalInfo0, Goal, !SlotInfo) :-
     (
-        GoalExpr0 = conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
         goal_info_get_nonlocals(GoalInfo0, NonLocals),
         saved_vars_in_conj(Goals0, Goals, NonLocals, !SlotInfo),
         conj_list_to_goal(Goals, GoalInfo0, Goal)
     ;
-        GoalExpr0 = par_conj(Goals0),
-        % saved_vars_in_disj treats its goal list as an independent list
-        % of goals, so we can use it to process the list of parallel
-        % conjuncts too.
-        saved_vars_in_disj(Goals0, Goals, !SlotInfo),
-        Goal = par_conj(Goals) - GoalInfo0
+            ConjType = parallel_conj,
+            saved_vars_in_independent_goals(Goals0, Goals, !SlotInfo),
+            Goal = conj(ConjType, Goals) - GoalInfo0
+        )
     ;
         GoalExpr0 = disj(Goals0),
-        saved_vars_in_disj(Goals0, Goals, !SlotInfo),
+        saved_vars_in_independent_goals(Goals0, Goals, !SlotInfo),
         Goal = disj(Goals) - GoalInfo0
     ;
         GoalExpr0 = not(NegGoal0),
@@ -227,6 +227,7 @@
 ok_to_duplicate(dont_warn_singleton) = yes.
 ok_to_duplicate(mode_check_clauses_goal) = yes.
 ok_to_duplicate(will_not_modify_trail) = yes.
+ok_to_duplicate(promise_same_deconstruct) = yes.
 
     % Divide a list of goals into an initial subsequence of goals
     % that construct constants, and all other goals.
@@ -261,7 +262,7 @@
     goal_info_get_nonlocals(FirstInfo, FirstNonLocals),
     ( set__member(Var, FirstNonLocals) ->
         (
-            FirstExpr = conj(_)
+            FirstExpr = conj(plain_conj, _)
         ;
             FirstExpr = scope(_, _)
         ;
@@ -344,15 +345,18 @@
                 IsNonLocal, !SlotInfo),
             Goals = [NewConstruct, Goal1 | Goals1]
         ;
-            Goal0Expr = conj(Conj),
-            list__append(Conj, Goals0, Goals1),
+            Goal0Expr = conj(ConjType, Conj),
+            (
+                ConjType = plain_conj,
+                list.append(Conj, Goals0, Goals1),
             saved_vars_delay_goal(Goals1, Goals, Construct, Var,
                 IsNonLocal, !SlotInfo)
         ;
-            Goal0Expr = par_conj(_ParConj),
+                ConjType = parallel_conj,
             saved_vars_delay_goal(Goals0, Goals1, Construct, Var,
                 IsNonLocal, !SlotInfo),
-            Goals = [Goal0|Goals1]
+                Goals = [Goal0 | Goals1]
+            )
         ;
             Goal0Expr = scope(Reason, SomeGoal0),
             rename_var(Var, NewVar, Subst, !SlotInfo),
@@ -477,17 +481,18 @@
 
 %-----------------------------------------------------------------------------%
 
-    % saved_vars_in_disj does a saved_vars_in_goal on an list of
+    % saved_vars_in_goal does a saved_vars_in_goal on an list of
     % independent goals, and is used to process disjunctions and
     % parallel conjunctions.
     %
-:- pred saved_vars_in_disj(list(hlds_goal)::in, list(hlds_goal)::out,
-    slot_info::in, slot_info::out) is det.
+:- pred saved_vars_in_independent_goals(list(hlds_goal)::in,
+    list(hlds_goal)::out, slot_info::in, slot_info::out) is det.
 
-saved_vars_in_disj([], [], !SlotInfo).
-saved_vars_in_disj([Goal0 | Goals0], [Goal | Goals], !SlotInfo) :-
+saved_vars_in_independent_goals([], [], !SlotInfo).
+saved_vars_in_independent_goals([Goal0 | Goals0], [Goal | Goals],
+        !SlotInfo) :-
     saved_vars_in_goal(Goal0, Goal, !SlotInfo),
-    saved_vars_in_disj(Goals0, Goals, !SlotInfo).
+    saved_vars_in_independent_goals(Goals0, Goals, !SlotInfo).
 
 :- pred saved_vars_in_switch(list(case)::in, list(case)::out,
     slot_info::in, slot_info::out) is det.
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.167
diff -u -b -r1.167 simplify.m
--- compiler/simplify.m	24 Feb 2006 01:41:54 -0000	1.167
+++ compiler/simplify.m	24 Feb 2006 02:24:13 -0000
@@ -446,7 +446,7 @@
         ),
         pd_cost__goal(Goal0, CostDelta),
         simplify_info_incr_cost_delta(CostDelta, !Info),
-        fail_goal(Context, Goal1)
+        Goal1 = fail_goal_with_context(Context)
     ;
         %
         % If --no-fully-strict, replace goals which cannot fail and have
@@ -488,10 +488,10 @@
 %       % cases are usually spurious.
 %       (
 %           simplify_do_warn(!.Info),
-%           % Goal0 \= conj([]) - _,
+%           % Goal0 \= conj(plain_conj, []) - _,
 %           \+ (Goal0 = call(_, _, _, _, _, SymName) - _,
 %               unqualify_name(SymName, "!")),
-%           Goal0 \= conj(_) - _,
+%           Goal0 \= conj(plain_conj, _) - _,
 %           Goal0 \= some(_, _) - _,
 %           \+ (Goal0 = unify(_, _, _, Unification, _) - _,
 %               Unification = deconstruct(_, _, _, _, _))
@@ -513,7 +513,7 @@
         pd_cost__goal(Goal0, CostDelta),
         simplify_info_incr_cost_delta(CostDelta, !Info),
         goal_info_get_context(GoalInfo0, Context),
-        true_goal(Context, Goal1)
+        Goal1 = true_goal_with_context(Context)
     ;
         Goal1 = Goal0
     ),
@@ -574,7 +574,10 @@
     hlds_goal_info::in, hlds_goal_info::out,
     simplify_info::in, simplify_info::out, io::di, io::uo) is det.
 
-simplify_goal_2(conj(Goals0), Goal, GoalInfo0, GoalInfo, !Info, !IO) :-
+simplify_goal_2(conj(ConjType, Goals0), Goal, GoalInfo0, GoalInfo,
+        !Info, !IO) :-
+    (
+        ConjType = plain_conj,
     simplify_info_get_instmap(!.Info, InstMap0),
     excess_assigns_in_conj(GoalInfo0, Goals0, Goals1, !Info),
     simplify_conj(Goals1, [], Goals, GoalInfo0, !Info, !IO),
@@ -582,12 +585,12 @@
     (
         Goals = [],
         goal_info_get_context(GoalInfo0, Context),
-        true_goal(Context, Goal - GoalInfo)
+            Goal - GoalInfo = true_goal_with_context(Context)
     ;
         Goals = [SingleGoal - SingleGoalInfo],
-        % a singleton conjunction is equivalent to the goal itself
-        maybe_wrap_goal(GoalInfo0, SingleGoalInfo, SingleGoal, Goal, GoalInfo,
-            !Info)
+            % A singleton conjunction is equivalent to the goal itself.
+            maybe_wrap_goal(GoalInfo0, SingleGoalInfo, SingleGoal,
+                Goal, GoalInfo, !Info)
     ;
         Goals = [_, _ | _],
         %
@@ -603,29 +606,30 @@
         ->
             determinism_components(InnerDetism, CanFail, at_most_many),
             goal_info_set_determinism(InnerDetism, GoalInfo0, InnerInfo),
-            InnerGoal = conj(Goals) - InnerInfo,
+                InnerGoal = conj(plain_conj, Goals) - InnerInfo,
             Goal = scope(commit(dont_force_pruning), InnerGoal)
         ;
-            Goal = conj(Goals)
+                Goal = conj(plain_conj, Goals)
         ),
         GoalInfo = GoalInfo0
-    ).
-
-simplify_goal_2(par_conj(Goals0), Goal, GoalInfo0, GoalInfo, !Info, !IO) :-
+        )
+    ;
+        ConjType = parallel_conj,
     (
         Goals0 = [],
         goal_info_get_context(GoalInfo0, Context),
-        true_goal(Context, Goal - GoalInfo)
+            Goal - GoalInfo = true_goal_with_context(Context)
     ;
         Goals0 = [SingleGoal0],
         simplify_goal(SingleGoal0, SingleGoal - SingleGoalInfo, !Info, !IO),
-        maybe_wrap_goal(GoalInfo0, SingleGoalInfo, SingleGoal, Goal, GoalInfo,
-            !Info)
+            maybe_wrap_goal(GoalInfo0, SingleGoalInfo, SingleGoal,
+                Goal, GoalInfo, !Info)
     ;
         Goals0 = [_, _ | _],
         GoalInfo = GoalInfo0,
         simplify_par_conj(Goals0, Goals, !.Info, !Info, !IO),
-        Goal = par_conj(Goals)
+            Goal = conj(parallel_conj, Goals)
+        )
     ).
 
 simplify_goal_2(disj(Disjuncts0), Goal, GoalInfo0, GoalInfo, !Info, !IO) :-
@@ -635,7 +639,7 @@
     (
         Disjuncts = [],
         goal_info_get_context(GoalInfo0, Context),
-        fail_goal(Context, Goal - GoalInfo)
+        Goal - GoalInfo = fail_goal_with_context(Context)
     ;
         Disjuncts = [SingleGoal],
         % A singleton disjunction is equivalent to the goal itself.
@@ -698,7 +702,7 @@
         pd_cost__eliminate_switch(CostDelta),
         simplify_info_incr_cost_delta(CostDelta, !Info),
         goal_info_get_context(GoalInfo0, Context),
-        fail_goal(Context, Goal - GoalInfo)
+        Goal - GoalInfo = fail_goal_with_context(Context)
     ;
         Cases = [case(ConsId, SingleGoal)],
         % A singleton switch is equivalent to the goal itself with a
@@ -748,7 +752,7 @@
                     CombinedGoalInfo),
 
                 simplify_info_set_requantify(!Info),
-                Goal = conj(GoalList),
+                Goal = conj(plain_conj, GoalList),
                 GoalInfo = CombinedGoalInfo
             )
         ;
@@ -862,7 +866,7 @@
         RT0 = var(LT0)
     ->
         goal_info_get_context(GoalInfo0, Context),
-        true_goal(Context, Goal - GoalInfo)
+        Goal - GoalInfo = true_goal_with_context(Context)
     ;
         RT0 = lambda_goal(Purity, PredOrFunc, EvalMethod, NonLocals,
             Vars, Modes, LambdaDeclaredDet, LambdaGoal0)
@@ -871,8 +875,7 @@
         simplify_info_get_common_info(!.Info, Common1),
         simplify_info_get_module_info(!.Info, ModuleInfo),
         simplify_info_get_instmap(!.Info, InstMap1),
-        instmap__pre_lambda_update(ModuleInfo, Vars, Modes,
-            InstMap1, InstMap2),
+        instmap.pre_lambda_update(ModuleInfo, Vars, Modes, InstMap1, InstMap2),
         simplify_info_set_instmap(InstMap2, !Info),
 
         % Don't attempt to pass structs into lambda_goals,
@@ -957,7 +960,8 @@
         goal_to_conj_list(Cond0, CondList),
         goal_to_conj_list(Then0, ThenList),
         list__append(CondList, ThenList, List),
-        simplify_goal(conj(List) - GoalInfo0, Goal - GoalInfo, !Info, !IO),
+        simplify_goal(conj(plain_conj, List) - GoalInfo0, Goal - GoalInfo,
+            !Info, !IO),
         goal_info_get_context(GoalInfo0, Context),
         Msg = ite_cond_cannot_fail,
         ContextMsg = context_det_msg(Context, Msg),
@@ -1000,7 +1004,8 @@
         ),
         goal_to_conj_list(Else0, ElseList),
         List = [Cond | ElseList],
-        simplify_goal(conj(List) - GoalInfo0, Goal - GoalInfo, !Info, !IO),
+        simplify_goal(conj(plain_conj, List) - GoalInfo0, Goal - GoalInfo,
+            !Info, !IO),
         goal_info_get_context(GoalInfo0, Context),
         Msg = ite_cond_cannot_succeed,
         ContextMsg = context_det_msg(Context, Msg),
@@ -1012,7 +1017,8 @@
         goal_to_conj_list(Cond0, CondList),
         goal_to_conj_list(Then0, ThenList),
         list__append(CondList, ThenList, List),
-        simplify_goal(conj(List) - GoalInfo0, Goal - GoalInfo, !Info, !IO),
+        simplify_goal(conj(plain_conj, List) - GoalInfo0, Goal - GoalInfo,
+            !Info, !IO),
         simplify_info_set_requantify(!Info),
         simplify_info_set_rerun_det(!Info)
     ;
@@ -1112,14 +1118,14 @@
     ),
     (
         % replace `not true' with `fail'
-        Goal1 = conj([]) - _GoalInfo
+        Goal1 = conj(plain_conj, []) - _GoalInfo
     ->
-        fail_goal(Context, Goal - GoalInfo)
+        Goal - GoalInfo = fail_goal_with_context(Context)
     ;
         % replace `not fail' with `true'
         Goal1 = disj([]) - _GoalInfo2
     ->
-        true_goal(Context, Goal - GoalInfo)
+        Goal - GoalInfo = true_goal_with_context(Context)
     ;
         % remove double negation
         Goal1 = not(SubGoal - SubGoalInfo) - _,
@@ -1161,7 +1167,7 @@
             FinalReason = exist_quant(_),
             KeepCommon = no
         ;
-            FinalReason = promise_equivalent_solutions(_),
+            FinalReason = promise_solutions(_, _),
             KeepCommon = no
         ),
         (
@@ -1278,10 +1284,10 @@
 
     (
         Invert   = no,
-        GoalExpr = conj([CmpGoal, UfyGoal])
+        GoalExpr = conj(plain_conj, [CmpGoal, UfyGoal])
     ;
         Invert   = yes,
-        GoalExpr = conj([CmpGoal, not(UfyGoal) - UfyInfo])
+        GoalExpr = conj(plain_conj, [CmpGoal, not(UfyGoal) - UfyInfo])
     ).
 
 %-----------------------------------------------------------------------------%
@@ -1774,14 +1780,14 @@
 simplify_conj([Goal0 | Goals0], !.RevGoals, Goals, ConjInfo, !Info, !IO) :-
     Info0 = !.Info,
     % Flatten conjunctions.
-    ( Goal0 = conj(SubGoals) - _ ->
+    ( Goal0 = conj(plain_conj, SubGoals) - _ ->
         list__append(SubGoals, Goals0, Goals1),
         simplify_conj(Goals1, !.RevGoals, Goals, ConjInfo, !Info, !IO)
     ;
         simplify_goal(Goal0, Goal1, !Info, !IO),
         (
             % Flatten conjunctions.
-            Goal1 = conj(SubGoals1) - _
+            Goal1 = conj(plain_conj, SubGoals1) - _
         ->
             simplify_info_undo_goal_updates(Info0, !Info),
             list__append(SubGoals1, Goals0, Goals1),
@@ -1815,8 +1821,8 @@
                 % determinism information when deciding what can never succeed.
                 Goal0 = _ - GoalInfo0,
                 goal_info_get_context(GoalInfo0, Context),
-                fail_goal(Context, Fail),
-                conjoin_goal_and_rev_goal_list(Fail, !RevGoals)
+                FailGoal = fail_goal_with_context(Context),
+                conjoin_goal_and_rev_goal_list(FailGoal, !RevGoals)
             ),
             list__reverse(!.RevGoals, Goals)
         ;
@@ -1830,7 +1836,7 @@
     hlds_goals::in, hlds_goals::out) is det.
 
 conjoin_goal_and_rev_goal_list(Goal, RevGoals0, RevGoals) :-
-    ( Goal = conj(Goals) - _ ->
+    ( Goal = conj(plain_conj, Goals) - _ ->
         list__reverse(Goals, Goals1),
         list__append(Goals1, RevGoals0, RevGoals)
     ;
@@ -2212,7 +2218,7 @@
         Cond = Disjunct,
         Cond = _CondGoal - CondGoalInfo,
 
-        true_goal(Then),
+        Then = true_goal,
 
         det_disj_to_ite(Disjuncts, GoalInfo, Rest),
         Rest = _RestGoal - RestGoalInfo,
@@ -2603,8 +2609,14 @@
         BeforeAfter = after,
         WillFlush = yes
     ).
-will_flush(par_conj(_), _) = yes.
-will_flush(conj(_), _) = no.
+will_flush(conj(ConjType, _), _) = WillFlush :-
+    (
+        ConjType = plain_conj,
+        WillFlush = no
+    ;
+        ConjType = parallel_conj,
+        WillFlush = yes
+    ).
 will_flush(switch(_, _, _), _) = no.
 will_flush(disj(_), BeforeAfter) = WillFlush :-
     (
Index: compiler/size_prof.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/size_prof.m,v
retrieving revision 1.31
diff -u -b -r1.31 size_prof.m
--- compiler/size_prof.m	16 Feb 2006 05:48:30 -0000	1.31
+++ compiler/size_prof.m	24 Feb 2006 02:32:11 -0000
@@ -319,11 +319,12 @@
         GoalExpr0 = foreign_proc(_, _, _, _, _, _),
         GoalExpr = GoalExpr0
     ;
-        GoalExpr0 = conj(Goals0),
-        process_conj(Goals0, Goals, !Info),
-        GoalExpr = conj(Goals)
+        GoalExpr0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
+            process_conj(Goals0, Goals, !Info)
     ;
-        GoalExpr0 = par_conj(Goals0),
+            ConjType = parallel_conj,
         % This transformation produces code that is much less than
         % optimal. However, it ought to be more robust than any better
         % transformation, and there is no point in spending time on a
@@ -340,8 +341,9 @@
         !:Info = !.Info ^ rev_type_info_map := RevTypeInfoMap0,
         !:Info = !.Info ^ type_ctor_map := map__init,
         !:Info = !.Info ^ rev_type_ctor_map := map__init,
-        !:Info = !.Info ^ known_size_map := KnownSizeMap0,
-        GoalExpr = par_conj(Goals)
+            !:Info = !.Info ^ known_size_map := KnownSizeMap0
+        ),
+        GoalExpr = conj(ConjType, Goals)
     ;
         GoalExpr0 = switch(SwitchVar, CanFail, Cases0),
         (
@@ -481,7 +483,7 @@
 process_conj([Goal0 | Goals0], Conj, !Info) :-
     process_goal(Goal0, Goal, !Info),
     process_conj(Goals0, Goals, !Info),
-    ( Goal = conj(SubConj) - _ ->
+    ( Goal = conj(plain_conj, SubConj) - _ ->
         % Flatten out any conjunction introduced by process_goal.
         % We never create conjunctions more than one level deep,
         % so this single test is sufficient to ensure that we never
@@ -726,7 +728,7 @@
         goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
         UnifyGoal = UnifyExpr - GoalInfo,
         Goals = list__condense([ArgGoals, SizeGoals, [UnifyGoal]]),
-        GoalExpr = conj(Goals)
+        GoalExpr = conj(plain_conj, Goals)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -759,7 +761,7 @@
             Context, UpdateGoal),
         % Put UnifyGoal first in case it fails.
         Goals = [UnifyGoal] ++ ArgGoals ++ SizeGoals ++ [UpdateGoal],
-        GoalExpr = conj(Goals)
+        GoalExpr = conj(plain_conj, Goals)
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.94
diff -u -b -r1.94 store_alloc.m
--- compiler/store_alloc.m	28 Nov 2005 04:11:55 -0000	1.94
+++ compiler/store_alloc.m	24 Feb 2006 02:31:03 -0000
@@ -170,15 +170,17 @@
     last_locns::in, last_locns::out, set(prog_var)::in, set(prog_var)::in,
     store_alloc_info::in) is det.
 
-store_alloc_in_goal_2(conj(Goals0), conj(Goals), !Liveness, !LastLocns,
-        ResumeVars0, _, StoreAllocInfo) :-
-    store_alloc_in_conj(Goals0, Goals, !Liveness, !LastLocns,
-        ResumeVars0, StoreAllocInfo).
-
-store_alloc_in_goal_2(par_conj(Goals0), par_conj(Goals),
+store_alloc_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
         !Liveness, !LastLocns, ResumeVars0, _, StoreAllocInfo) :-
+    (
+        ConjType = plain_conj,
+        store_alloc_in_conj(Goals0, Goals, !Liveness, !LastLocns,
+            ResumeVars0, StoreAllocInfo)
+    ;
+        ConjType = parallel_conj,
     store_alloc_in_par_conj(Goals0, Goals, !Liveness, !LastLocns,
-        ResumeVars0, StoreAllocInfo).
+            ResumeVars0, StoreAllocInfo)
+    ).
 
 store_alloc_in_goal_2(disj(Goals0), disj(Goals), !Liveness, !LastLocns,
         ResumeVars0, _, StoreAllocInfo) :-
@@ -233,7 +235,7 @@
         !Liveness, !LastLocns, _, _, _).
 
 store_alloc_in_goal_2(shorthand(_), _, _, _, _, _, _, _, _) :-
-    % these should have been expanded out by now
+    % These should have been expanded out by now.
     unexpected(this_file, "store_alloc_in_goal_2: unexpected shorthand").
 
 %-----------------------------------------------------------------------------%
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.45
diff -u -b -r1.45 stratify.m
--- compiler/stratify.m	23 Feb 2006 09:37:09 -0000	1.45
+++ compiler/stratify.m	24 Feb 2006 03:49:26 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1996-2006 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -33,11 +35,11 @@
 
 :- import_module io.
 
-	% Perform stratification analysis, for the given module.
-	% If the "warn-non-stratification" option is set this
-	% pred will check the entire module for stratification
-	% otherwise it will only check preds in the stratified_preds
-	% set of the module_info structure.
+    % Perform stratification analysis, for the given module. If the
+    % "warn-non-stratification" option is set, this predicate will check
+    % the entire module for stratification, otherwise it will only check
+    % the predicates in the stratified_preds set of the module_info structure.
+    %
 :- pred stratify__check_stratification(module_info::in, module_info::out,
 	io::di, io::uo) is det.
 
@@ -80,8 +82,7 @@
 	dep_sets_to_lists_and_sets(FOSCCs1, [], FOSCCs),
 	globals__io_lookup_bool_option(warn_non_stratification, Warn, !IO),
 	module_info_get_stratified_preds(!.ModuleInfo, StratifiedPreds),
-	first_order_check_sccs(FOSCCs, StratifiedPreds, Warn, !ModuleInfo,
-		!IO).
+    first_order_check_sccs(FOSCCs, StratifiedPreds, Warn, !ModuleInfo, !IO).
 
 	% The following code was used for the second pass of this module but
 	% as that pass is disabled so is this code. The higher order code
@@ -111,7 +112,8 @@
 
 get_proc_id(proc(PredId, _), PredId).
 
-	% check the first order SCCs for stratification
+    % Check the first order SCCs for stratification.
+    %
 :- pred first_order_check_sccs(
 	assoc_list(list(pred_proc_id), set(pred_id))::in,
 	set(pred_id)::in, bool::in, module_info::in, module_info::out,
@@ -161,11 +163,7 @@
 	bool::in, list(pred_proc_id)::in, pred_proc_id::in, bool::in,
 	module_info::in, module_info::out, io::di, io::uo) is det.
 
-first_order_check_goal(conj(Goals), _GoalInfo, Negated, WholeScc,
-		ThisPredProcId, Error, !ModuleInfo, !IO) :-
-	first_order_check_goal_list(Goals, Negated, WholeScc, ThisPredProcId,
-		Error, !ModuleInfo, !IO).
-first_order_check_goal(par_conj(Goals), _GoalInfo, Negated, WholeScc,
+first_order_check_goal(conj(_ConjType, Goals), _GoalInfo, Negated, WholeScc,
 		ThisPredProcId, Error, !ModuleInfo, !IO) :-
 	first_order_check_goal_list(Goals, Negated, WholeScc, ThisPredProcId,
 		Error, !ModuleInfo, !IO).
@@ -178,8 +176,8 @@
 	first_order_check_case_list(Cases, Negated, WholeScc, ThisPredProcId,
 		Error, !ModuleInfo, !IO).
 first_order_check_goal(if_then_else(_Vars, Cond - CInfo, Then - TInfo,
-		Else - EInfo), _GoalInfo, Negated, WholeScc, ThisPredProcId,
-		Error, !ModuleInfo, !IO) :-
+        Else - EInfo), _GoalInfo, Negated, WholeScc, ThisPredProcId, Error,
+        !ModuleInfo, !IO) :-
 	first_order_check_goal(Cond, CInfo, yes, WholeScc, ThisPredProcId,
 		Error, !ModuleInfo, !IO),
 	first_order_check_goal(Then, TInfo, Negated, WholeScc, ThisPredProcId,
@@ -203,16 +201,14 @@
 	->
 		goal_info_get_context(GoalInfo, Context),
 		emit_message(ThisPredProcId, Context,
-			"call introduces a non-stratified loop",
-			Error, !ModuleInfo, !IO)
+            "call introduces a non-stratified loop", Error, !ModuleInfo, !IO)
 	;
 		true
 	).
 first_order_check_goal(unify(_Var, _RHS, _Mode, _Uni, _Context), _GoalInfo,
 	_Negated, _WholeScc, _ThisPredProcId, _, !ModuleInfo, !IO).
 first_order_check_goal(call(CPred, CProc, _Args, _BuiltinState, _Contex, _Sym),
-		GInfo, Negated, WholeScc, ThisPredProcId, Error, !ModuleInfo,
-		!IO) :-
+        GInfo, Negated, WholeScc, ThisPredProcId, Error, !ModuleInfo, !IO) :-
 	Callee = proc(CPred, CProc),
 	(
 		Negated = yes,
@@ -220,8 +216,7 @@
 	->
 		goal_info_get_context(GInfo, Context),
 		emit_message(ThisPredProcId, Context,
-			"call introduces a non-stratified loop",
-			Error, !ModuleInfo, !IO)
+            "call introduces a non-stratified loop", Error, !ModuleInfo, !IO)
 	;
 		true
 	).
@@ -229,8 +224,7 @@
 	_Negated, _WholeScc, _ThisPredProcId, _Error,  !ModuleInfo, !IO).
 first_order_check_goal(shorthand(_), _, _, _, _, _, !ModuleInfo, !IO) :-
 	% these should have been expanded out by now
-	unexpected(this_file,
-		"first_order_check_goal: unexpected shorthand").
+    unexpected(this_file, "first_order_check_goal: unexpected shorthand").
 
 :- pred first_order_check_goal_list(list(hlds_goal)::in, bool::in,
 	list(pred_proc_id)::in, pred_proc_id::in, bool::in,
@@ -262,7 +256,8 @@
  % XXX : Currently we don't allow the higher order case so this code
  % is disabled.
 
-	% check the higher order SCCs for stratification
+    % Check the higher order SCCs for stratification.
+    %
 :- pred higher_order_check_sccs(
 	assoc_list(list(pred_proc_id), set(pred_proc_id))::in,
 	ho_map::in, module_info::in, module_info::out, io::di, io::uo) is det.
@@ -307,11 +302,7 @@
 	bool::in, set(pred_proc_id)::in, pred_proc_id::in, bool::in, bool::in,
 	module_info::in, module_info::out, io::di, io::uo) is det.
 
-higher_order_check_goal(conj(Goals), _GoalInfo, Negated, WholeScc,
-		ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO) :-
-	higher_order_check_goal_list(Goals, Negated, WholeScc, ThisPredProcId,
-		HighOrderLoops, Error, !ModuleInfo, !IO).
-higher_order_check_goal(par_conj(Goals), _GoalInfo, Negated, WholeScc,
+higher_order_check_goal(conj(_ConjType, Goals), _GoalInfo, Negated, WholeScc,
 		ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO) :-
 	higher_order_check_goal_list(Goals, Negated, WholeScc, ThisPredProcId,
 		HighOrderLoops, Error, !ModuleInfo, !IO).
@@ -319,9 +310,8 @@
 		ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO) :-
 	higher_order_check_goal_list(Goals, Negated, WholeScc, ThisPredProcId,
 		HighOrderLoops, Error, !ModuleInfo, !IO).
-higher_order_check_goal(switch(_Var, _Fail, Cases), _GoalInfo,
-		Negated, WholeScc, ThisPredProcId, HighOrderLoops,
-		Error, !ModuleInfo, !IO) :-
+higher_order_check_goal(switch(_Var, _Fail, Cases), _GoalInfo, Negated,
+        WholeScc, ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO) :-
 	higher_order_check_case_list(Cases, Negated, WholeScc, ThisPredProcId,
 		HighOrderLoops, Error, !ModuleInfo, !IO).
 higher_order_check_goal(if_then_else(_Vars, Cond - CInfo, Then - TInfo,
@@ -334,8 +324,7 @@
 	higher_order_check_goal(Else, EInfo, Negated, WholeScc, ThisPredProcId,
 		HighOrderLoops, Error, !ModuleInfo, !IO).
 higher_order_check_goal(scope(_, Goal - GoalInfo), _GoalInfo, Negated,
-		WholeScc, ThisPredProcId, HighOrderLoops,
-		Error, !ModuleInfo, !IO) :-
+        WholeScc, ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO) :-
 	higher_order_check_goal(Goal, GoalInfo, Negated, WholeScc,
 		ThisPredProcId, HighOrderLoops, Error, !ModuleInfo, !IO).
 higher_order_check_goal(not(Goal - GoalInfo), _GoalInfo, _Negated, WholeScc,
@@ -363,7 +352,6 @@
 		emit_message(ThisPredProcId, Context,
 			"call to solutions/2 introduces a non-stratified loop",
 			Error, !ModuleInfo, !IO)
-
 	;
 		true
 	).
@@ -379,18 +367,15 @@
 		)
 	->
 		goal_info_get_context(GoalInfo, Context),
-		string__append(Msg,
-			" call may introduce a non-stratified loop",
-			ErrorMsg),
-		emit_message(ThisPredProcId, Context, ErrorMsg,
-			Error, !ModuleInfo, !IO)
+        ErrorMsg = Msg ++ " call may introduce a non-stratified loop",
+        emit_message(ThisPredProcId, Context, ErrorMsg, Error, !ModuleInfo,
+            !IO)
 	;
 		true
 	).
 higher_order_check_goal(shorthand(_), _, _, _, _, _, _, _, _, !IO) :-
 	% these should have been expanded out by now
-	unexpected(this_file,
-		"higher_order_check_goal: unexpected shorthand").
+    unexpected(this_file, "higher_order_check_goal: unexpected shorthand").
 
 :- pred higher_order_check_goal_list(list(hlds_goal)::in, bool::in,
 	set(pred_proc_id)::in, pred_proc_id::in, bool::in, bool::in,
@@ -420,38 +405,35 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-	% direction higher order params can flow in a proc
+    % Direction higher order params can flow in a procedure.
 :- type ho_in_out
 	--->	ho_in
 	;	ho_out
 	;	ho_in_out
 	;	ho_none.
 
-	% this structure is used to hold the higher order
-	% characteristics of a proc
+    % This structure is used to hold the higher order characteristics of a
+    % procedure.
 :- type higher_order_info
 	--->	info(
-			set(pred_proc_id),  % possible higher order
-					    % addrs than can reach the
-					    % proc
-			ho_in_out	    % possible paths the addrs can
-					    % take in and out of the proc
+                set(pred_proc_id),  % Possible higher order addresses that
+                                    % can reach the procedure.
+                ho_in_out           % Possible paths the address can take
+                                    % in and out of the procedure.
 		).
 
-	% a map from all non imported procs to there higher order
-	% info
+    % A map from all non imported procedures to there higher order info.
 :- type ho_map   == map(pred_proc_id, higher_order_info).
 
-	% a map from all non imported procs to all the procs they can
-	% call
+    % A map from all non imported procs to all the procedures they can call.
 :- type call_map == map(pred_proc_id, set(pred_proc_id)).
 
-	% given a module and a dependency graph this pred
-	% builds a new dependency graph with all possible
-	% higher order calls added, it also returns a map of all the
-	% higher order info collected by this pred
-:- pred gen_conservative_graph(module_info::in, dependency_graph::in,
-	dependency_graph::out, ho_map::out) is det.
+    % Given a module and a dependency graph, this predicate builds
+    % a new dependency graph with all possible higher order calls added.
+    % It also returns a map of all the higher order info it collects.
+    %
+:- pred gen_conservative_graph(module_info::in,
+    dependency_graph::in, dependency_graph::out, ho_map::out) is det.
 
 gen_conservative_graph(ModuleInfo, !DepGraph, HOInfo) :-
 	get_call_info(ModuleInfo, ProcCalls, HOInfo0, CallsHO),
@@ -460,10 +442,11 @@
 	map__to_assoc_list(HOInfo, HOInfoL),
 	add_new_arcs(HOInfoL, CallsHO, !DepGraph).
 
-	% For a given module collects for each non imported proc a set
-	% of called procs and a higher order info structure. This pred
-	% also returns a set of all non imported procs that make a
-	% higher order call
+    % For a given module, collects for each non imported procedure
+    % a set of called procedures and a higher order info structure.
+    % This pred also returns a set of all non imported procedures that
+    % make a higher order call.
+    %
 :- pred get_call_info(module_info::in, call_map::out, ho_map::out,
 	set(pred_proc_id)::out) is det.
 
@@ -474,9 +457,10 @@
 	module_info_predids(ModuleInfo, PredIds),
 	expand_predids(PredIds, ModuleInfo, !ProcCalls, !HOInfo, !CallsHO).
 
-	% find the transitive closure of a given list of procs
-	% this pred is used to see how face a higher order address can
-	% reach though proc calls
+    % Finds the transitive closure of a given list of procedures.
+    % This pred is used to see how face(???) a higher order address
+    % can reach though procedure calls.
+    %
 :- pred iterate_solution(list(pred_proc_id)::in, call_map::in,
 	set(pred_proc_id)::in, ho_map::in, ho_map::out) is det.
 
@@ -489,21 +473,23 @@
                 iterate_solution(PredProcs, ProcCalls, CallsHO, !HOInfo)
         ).
 
-	% for each caller merge any higher order addresses it takes with all of
-	% its callees and return if any change has occurred
+    % For each caller, merge any higher order addresses it takes with all of
+    % its callees, and return if any change has occurred.
+    %
 :- pred tc(list(pred_proc_id)::in, call_map::in, set(pred_proc_id)::in,
 	ho_map::in, ho_map::out, bool::in, bool::out) is det.
 
 tc([], _, _, !HOInfo, !Changed).
-tc([P | Ps], ProcCalls, CallsHO, !HOInfo, !Changed) :-
-	map__lookup(ProcCalls, P, PCalls),
+tc([PredProcId | PredProcIds], ProcCalls, CallsHO, !HOInfo, !Changed) :-
+    map__lookup(ProcCalls, PredProcId, PCalls),
 	set__to_sorted_list(PCalls, PCallsL),
-	merge_calls(PCallsL, P, CallsHO, yes, !HOInfo, !Changed),
-	tc(Ps, ProcCalls, CallsHO, !HOInfo, !Changed).
+    merge_calls(PCallsL, PredProcId, CallsHO, yes, !HOInfo, !Changed),
+    tc(PredProcIds, ProcCalls, CallsHO, !HOInfo, !Changed).
 
-	% merge any higher order addresses that can pass between the
-	% given caller and callees. This code also merges any possible
-	% addresses that can pass in and out of higher order calls
+    % Merge any higher order addresses that can pass between the given caller
+    % and callees. This code also merges any possible addresses that can pass
+    % in and out of higher order calls.
+    %
 :- pred merge_calls(list(pred_proc_id)::in, pred_proc_id::in,
 	set(pred_proc_id)::in, bool::in, ho_map::in, ho_map::out,
 	bool::in, bool::out) is det.
@@ -514,7 +500,7 @@
 		map__lookup(!.HOInfo, P, PInfo),
 		CInfo = info(CHaveAT0, CHOInOut),
 		PInfo = info(PHaveAT0, PHOInOut),
-		% first merge the first order info, if we need to
+        % First merge the first order info, if we need to.
 		( CHOInOut = ho_none ->
 			true
 		;
@@ -523,8 +509,7 @@
 				( set__subset(PHaveAT0, CHaveAT0) ->
 					CHaveAT = CHaveAT0
 				;
-					set__union(PHaveAT0, CHaveAT0,
-						CHaveAT),
+                    set__union(PHaveAT0, CHaveAT0, CHaveAT),
 					!:Changed = yes
 				),
 				PHaveAT = PHaveAT0
@@ -533,8 +518,7 @@
 				( set__subset(CHaveAT0, PHaveAT0) ->
 					PHaveAT = PHaveAT0
 				;
-					set__union(CHaveAT0, PHaveAT0,
-						PHaveAT),
+                    set__union(CHaveAT0, PHaveAT0, PHaveAT),
 					!:Changed = yes
 				),
 				CHaveAT = CHaveAT0
@@ -544,8 +528,7 @@
 					CHaveAT = CHaveAT0,
 					PHaveAT = PHaveAT0
 				;
-					set__union(CHaveAT0, PHaveAT0,
-						NewHaveAT),
+                    set__union(CHaveAT0, PHaveAT0, NewHaveAT),
 					CHaveAT = NewHaveAT,
 					PHaveAT = NewHaveAT,
 					!:Changed = yes
@@ -553,15 +536,14 @@
 			;
 				CHOInOut = ho_none,
 				% XXX : what is a good message for this?
-				unexpected(this_file,
-					"merge_calls : this cannot happen!")
+                unexpected(this_file, "merge_calls : this cannot happen!")
 			),
 			NewCInfo = info(CHaveAT, CHOInOut),
 			NewPInfo = info(PHaveAT, PHOInOut),
 			map__det_update(!.HOInfo, C, NewCInfo, !:HOInfo),
 			map__det_update(!.HOInfo, P, NewPInfo, !:HOInfo)
 		),
-		% then, if we need to, merge the higher order info
+        % Then, if we need to, merge the higher order info.
 		(
 			DoingFirstOrder = yes,
 			set__member(P, CallsHO)
@@ -569,8 +551,7 @@
 			map__lookup(!.HOInfo, P, PHOInfo),
 			PHOInfo = info(PossibleCalls, _),
 			set__to_sorted_list(PossibleCalls, PossibleCallsL),
-			merge_calls(PossibleCallsL, P, CallsHO, no,
-				!HOInfo, !Changed)
+            merge_calls(PossibleCallsL, P, CallsHO, no, !HOInfo, !Changed)
 		;
 			true
 		),
@@ -579,20 +560,17 @@
 		merge_calls(Cs, P, CallsHO, DoingFirstOrder, !HOInfo, !Changed)
 	).
 
-	% given the set of procs that make higher order calls and a
-	% list of procs and higher order call info this pred rebuilds
-	% the given call graph with new arcs for every possible higher
-	% order call
+    % Given the set of procedures that make higher order calls and a
+    % list of procedures and higher order call info, this predicate rebuilds
+    % the given call graph with new arcs for every possible higher order call.
+    %
 :- pred add_new_arcs(assoc_list(pred_proc_id, higher_order_info)::in,
-	set(pred_proc_id)::in, dependency_graph::in, dependency_graph::out)
-	is det.
+    set(pred_proc_id)::in, dependency_graph::in, dependency_graph::out) is det.
 
 add_new_arcs([], _, !DepGraph).
 add_new_arcs([Caller - CallerInfo | Cs], CallsHO, !DepGraph) :-
-	(
-		% only add arcs for callers who call higher order procs
-		set__member(Caller, CallsHO)
-	->
+    % Only add arcs for callers who call higher order procs.
+    ( set__member(Caller, CallsHO) ->
 		CallerInfo = info(PossibleCallees0, _),
 		set__to_sorted_list(PossibleCallees0, PossibleCallees),
 		relation__lookup_element(!.DepGraph, Caller, CallerKey),
@@ -611,8 +589,9 @@
 	relation__add(!.DepGraph, CallerKey, CalleeKey, !:DepGraph),
 	add_new_arcs2(Cs, CallerKey, !DepGraph).
 
-	% for each given pred id pass all non imported procs onto the
-	% process_procs pred
+    % For each given pred id, pass all non imported procs onto the
+    % process_procs predicate.
+    %
 :- pred expand_predids(list(pred_id)::in, module_info::in,
 	call_map::in, call_map::out, ho_map::in, ho_map::out,
 	set(pred_proc_id)::in, set(pred_proc_id)::out) is det.
@@ -628,8 +607,9 @@
 		!ProcCalls, !HOInfo, !CallsHO),
 	expand_predids(PredIds, ModuleInfo, !ProcCalls, !HOInfo, !CallsHO).
 
-	% for each given proc id generate the set of procs it calls and
-	% its higher order info structure
+    % For each given proc id, generate the set of procedures it calls
+    % and its higher order info structure.
+    %
 :- pred process_procs(list(proc_id)::in, module_info::in, pred_id::in,
 	list(mer_type)::in, proc_table::in, call_map::in, call_map::out,
 	ho_map::in, ho_map::out, set(pred_proc_id)::in, set(pred_proc_id)::out)
@@ -655,8 +635,9 @@
 	process_procs(Procs, ModuleInfo, PredId, ArgTypes, ProcTable,
 		!ProcCalls, !HOInfo, !CallsHO).
 
-	% determine if a given set of modes and types indicates that
-	% higher order values can be passed into and/or out of a proc
+    % Determine if a given set of modes and types indicates that
+    % higher order values can be passed into and/or out of a procedure.
+    %
 :- pred higherorder_in_out(list(mer_type)::in, list(mer_mode)::in,
 	module_info::in, ho_in_out::out) is det.
 
@@ -676,17 +657,15 @@
 
 higherorder_in_out1([], [], _ModuleInfo, !HOIn, !HOOut).
 higherorder_in_out1([], [_ | _], _, !HOIn, !HOOut) :-
-	unexpected(this_file,
-		"higherorder_in_out1: lists were different lengths").
+    unexpected(this_file, "higherorder_in_out1: lists were different lengths").
 higherorder_in_out1([_ | _], [], _, !HOIn, !HOOut) :-
-	unexpected(this_file,
-		"higherorder_in_out1: lists were different lengths").
+    unexpected(this_file, "higherorder_in_out1: lists were different lengths").
 higherorder_in_out1([Type | Types], [Mode | Modes], ModuleInfo,
 		!HOIn, !HOOut) :-
 	(
-		% 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..
+        % 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, _, _, _, _)
 	->
 		( mode_is_input(ModuleInfo, Mode) ->
@@ -701,8 +680,9 @@
 	),
 	higherorder_in_out1(Types, Modes, ModuleInfo, !HOIn, !HOOut).
 
-	% return the set of all procs called in and all addresses
-	% taken, in a given goal
+    % Return the set of all procedures called in the given goal
+    % and all addresses taken in the given goal.
+    %
 :- pred check_goal(hlds_goal_expr::in, set(pred_proc_id)::out,
 	set(pred_proc_id)::out, bool::out) is det.
 
@@ -716,24 +696,22 @@
 	set(pred_proc_id)::in, set(pred_proc_id)::out,
 	bool::in, bool::out) is det.
 
-	% see if a goal has its address taken
 check_goal1(unify(_Var, RHS, _Mode, Unification, _Context), !Calls,
 		!HasAT, !CallsHO) :-
+    % See if a goal has its address taken.
 	(
-		% currently this code assumes that all procs called in a
-		% lambda goal have addresses taken. this is not
-		% always to case, but should be a suitable approximation for
-		% the stratification analysis
-		RHS = lambda_goal(_Purity, _PredOrFunc, _EvalMethod,
-			_NonLocals, _Vars, _Modes, _Determinism,
-			Goal - _GoalInfo)
+        % Currently this code assumes that all procs called in a lambda goal
+        % have addresses taken. This is not always to case, but should be
+        % a suitable approximation for the stratification analysis.
+        RHS = lambda_goal(_Purity, _PredOrFunc, _EvalMethod, _NonLocals, _Vars,
+            _Modes, _Determinism, Goal - _GoalInfo)
 	->
 		get_called_procs(Goal, [], CalledProcs),
 		set__insert_list(!.HasAT, CalledProcs, !:HasAT)
 	;
-		% currently when this pass is run the construct/4
-		% case will not happen as higher order constants have
-		% been transformed to lambda goals. see above
+        % Currently when this pass is run the construct/4 case will not happen
+        % as higher order constants have been transformed to lambda goals.
+        % See above.
 		Unification = construct(_Var2, ConsId, _, _, _, _, _)
 	->
 		( ConsId = pred_const(ShroudedPredProcId, _) ->
@@ -745,15 +723,13 @@
 	;
 		true
 	).
-	% add this call to the call list
 check_goal1(call(CPred, CProc, _Args, _Builtin, _Contex, _Sym), !Calls,
 		!HasAT, !CallsHO) :-
+    % Add this call to the call list.
 	set__insert(!.Calls, proc(CPred, CProc), !:Calls).
-	% record that the higher order call was made
 check_goal1(generic_call(_Var, _Vars, _Modes, _Det), !Calls, !HasAT, _, yes).
-check_goal1(conj(Goals), !Calls, !HasAT, !CallsHO) :-
-	check_goal_list(Goals, !Calls, !HasAT, !CallsHO).
-check_goal1(par_conj(Goals), !Calls, !HasAT, !CallsHO) :-
+    % Record that the higher order call was made.
+check_goal1(conj(_ConjType, Goals), !Calls, !HasAT, !CallsHO) :-
 	check_goal_list(Goals, !Calls, !HasAT, !CallsHO).
 check_goal1(disj(Goals), !Calls, !HasAT, !CallsHO) :-
 	check_goal_list(Goals, !Calls, !HasAT, !CallsHO).
@@ -771,7 +747,7 @@
 check_goal1(foreign_proc(_Attrib, _CPred, _CProc, _, _, _),
 		!Calls, !HasAT, !CallsHO).
 check_goal1(shorthand(_), _, _, _, _, _, _) :-
-	% these should have been expanded out by now
+    % These should have been expanded out by now.
 	unexpected(this_file, "check_goal1: unexpected shorthand").
 
 :- pred check_goal_list(list(hlds_goal)::in,
@@ -795,27 +771,26 @@
 	check_goal1(Goal, !Calls, !HasAT, !CallsHO),
 	check_case_list(Goals, !Calls, !HasAT, !CallsHO).
 
-	% This pred returns a list of all the calls in a given set of
-	% goals including calls in unification lambda functions and
-	% pred_proc_id's in constructs
+    % This pred returns a list of all the calls in a given set of goals,
+    % including calls in unification lambda functions and pred_proc_id's
+    % in constructs.
+    %
 :- pred get_called_procs(hlds_goal_expr::in,
 	list(pred_proc_id)::in, list(pred_proc_id)::out) is det.
 
 get_called_procs(unify(_Var, RHS, _Mode, Unification, _Context), !Calls) :-
 	(
-		% currently this code assumes that all procs called in a
-		% lambda goal have addresses taken. this is not
-		% always to case, but should be a suitable approximation for
-		% the stratification analysis
-		RHS = lambda_goal(_Purity, _PredOrFunc, _EvalMethod,
-			_NonLocals, _Vars, _Modes, _Determinism,
-			Goal - _GoalInfo)
+        % Currently this code assumes that all procs called in a lambda goal
+        % have addresses taken. This is not always to case, but should be
+        % a suitable approximation for the stratification analysis.
+        RHS = lambda_goal(_Purity, _PredOrFunc, _EvalMethod, _NonLocals, _Vars,
+            _Modes, _Determinism, Goal - _GoalInfo)
 	->
 		get_called_procs(Goal, !Calls)
 	;
-		% currently when this pass is run the construct/4
-		% case will not happen as higher order constants have
-		% been transformed to lambda goals see above
+        % Currently when this pass is run the construct/4 case will not happen
+        % as higher order constants have been transformed to lambda goals.
+        % See above.
 		Unification = construct(_Var2, ConsId, _, _, _, _, _)
 	->
 		( ConsId = pred_const(ShroudedPredProcId, _) ->
@@ -828,15 +803,13 @@
 		true
 	).
 
-	% add this call to the call list
 get_called_procs(call(CPred, CProc, _Args, _Builtin, _Contex, _Sym), !Calls) :-
+    % Add this call to the call list.
 	!:Calls = [proc(CPred, CProc) | !.Calls].
 
 get_called_procs(generic_call(_Var, _Vars, _Modes, _Det), !Calls).
 
-get_called_procs(conj(Goals), !Calls) :-
-	check_goal_list(Goals, !Calls).
-get_called_procs(par_conj(Goals), !Calls) :-
+get_called_procs(conj(_ConjType, Goals), !Calls) :-
 	check_goal_list(Goals, !Calls).
 get_called_procs(disj(Goals), !Calls) :-
 	check_goal_list(Goals, !Calls).
@@ -852,7 +825,7 @@
 	get_called_procs(Goal, !Calls).
 get_called_procs(foreign_proc(_Attrib, _CPred, _CProc, _, _, _), !Calls).
 get_called_procs(shorthand(_), !Calls) :-
-	% these should have been expanded out by now
+    % These should have been expanded out by now.
 	unexpected(this_file, "get_called_procs: unexpected shorthand").
 
 :- pred check_goal_list(list(hlds_goal)::in,
Index: compiler/structure_sharing.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.analysis.m,v
retrieving revision 1.3
diff -u -b -r1.3 structure_sharing.analysis.m
--- compiler/structure_sharing.analysis.m	23 Feb 2006 09:37:09 -0000	1.3
+++ compiler/structure_sharing.analysis.m	24 Feb 2006 02:31:17 -0000
@@ -87,6 +87,7 @@
 
 :- pred load_structure_sharing_table_3(module_info::in, pred_id::in, 
     proc_id::in, sharing_as_table::in, sharing_as_table::out) is det.
+
 load_structure_sharing_table_3(ModuleInfo, PredId, ProcId, !SharingTable):- 
     module_info_proc_info(ModuleInfo, PredId, ProcId, ProcInfo), 
     proc_info_get_structure_sharing(ProcInfo, MaybePublicSharing),
@@ -101,6 +102,7 @@
     % Annotate the HLDS with pre-birth and post-death information, as
     % used by the liveness pass (liveness.m). This information is used to 
     % eliminate useless sharing pairs during sharing analysis. 
+    %
 :- pred annotate_liveness(module_info::in, module_info::out, io::di, 
     io::uo) is det.
 
@@ -116,7 +118,6 @@
 
 sharing_analysis(!ModuleInfo, !SharingTable, !IO):- 
     % Perform the analysis based on the strongly connected components. 
-    
     module_info_ensure_dependency_info(!ModuleInfo), 
     module_info_get_maybe_dependency_info(!.ModuleInfo, MaybeDepInfo), 
     (
@@ -128,38 +129,29 @@
         unexpected(this_file, "No dependency information.")
     ), 
     
-    % Record the sharing results in the HLDS
-    map.foldl(save_sharing_in_module_info, !.SharingTable, 
-        !ModuleInfo).
-
+    % Record the sharing results in the HLDS.
+    map.foldl(save_sharing_in_module_info, !.SharingTable, !ModuleInfo).
 
 :- pred save_sharing_in_module_info(pred_proc_id::in, sharing_as::in, 
     module_info::in, module_info::out) is det.
 
 save_sharing_in_module_info(PredProcId, SharingAs, !ModuleInfo) :- 
-    module_info_pred_proc_info(!.ModuleInfo, PredProcId, PredInfo0, 
-        ProcInfo0),
-    proc_info_set_structure_sharing( 
-        to_structure_sharing_domain(SharingAs), 
+    module_info_pred_proc_info(!.ModuleInfo, PredProcId, PredInfo0, ProcInfo0),
+    proc_info_set_structure_sharing(to_structure_sharing_domain(SharingAs),
         ProcInfo0, ProcInfo), 
-    module_info_set_pred_proc_info(PredProcId, PredInfo0, 
-        ProcInfo, !ModuleInfo).
+    module_info_set_pred_proc_info(PredProcId, PredInfo0, ProcInfo,
+        !ModuleInfo).
 
 :- pred analyse_scc(module_info::in, list(pred_proc_id)::in, 
-    sharing_as_table::in, sharing_as_table::out, 
-    io::di, io::uo) is det.
+    sharing_as_table::in, sharing_as_table::out, io::di, io::uo) is det.
 
 analyse_scc(ModuleInfo, SCC, !SharingTable, !IO):-
-    (
-        ctgc.util.preds_requiring_no_analysis(ModuleInfo, SCC)
-    -> 
+    ( ctgc.util.preds_requiring_no_analysis(ModuleInfo, SCC) ->
         true
     ;
-        analyse_scc_until_fixpoint(ModuleInfo, SCC, 
-            !.SharingTable, ss_fixpoint_table_init(SCC), 
-            FixpointTable, !IO),
-        list.foldl(update_sharing_in_table(FixpointTable), SCC, 
-            !SharingTable)
+        analyse_scc_until_fixpoint(ModuleInfo, SCC, !.SharingTable,
+            ss_fixpoint_table_init(SCC), FixpointTable, !IO),
+        list.foldl(update_sharing_in_table(FixpointTable), SCC, !SharingTable)
     ).
 
 :- pred analyse_scc_until_fixpoint(module_info::in, list(pred_proc_id)::in,
@@ -170,9 +162,7 @@
     !FixpointTable, !IO) :- 
     list.foldl2(analyse_pred_proc(ModuleInfo, SharingTable), 
         SCC, !FixpointTable, !IO), 
-    (
-        ss_fixpoint_table_stable(!.FixpointTable)
-    ->
+    ( ss_fixpoint_table_stable(!.FixpointTable) ->
         true
     ;
         ss_fixpoint_table_new_run(!FixpointTable),
@@ -181,19 +171,19 @@
     ).
 
 %-----------------------------------------------------------------------------%
+%
 % The heart of it all, analysing a single procedure: analyse_pred_proc.
-%-----------------------------------------------------------------------------%
+%
+
 :- pred analyse_pred_proc(module_info::in, sharing_as_table::in, 
     pred_proc_id::in, ss_fixpoint_table::in, ss_fixpoint_table::out, 
     io::di, io::uo) is det.
 
-analyse_pred_proc(ModuleInfo, SharingTable, PredProcId, 
-    !FixpointTable, !IO) :- 
-
+analyse_pred_proc(ModuleInfo, SharingTable, PredProcId, !FixpointTable, !IO) :-
     % Collect relevant compiler options. 
     globals.io_lookup_bool_option(very_verbose, Verbose, !IO),
-    globals.io_lookup_int_option(structure_sharing_widening, 
-        WideningLimit, !IO),
+    globals.io_lookup_int_option(structure_sharing_widening, WideningLimit,
+        !IO),
 
     % Collect relevant procedure information.
     module_info_pred_proc_info(ModuleInfo, PredProcId, PredInfo, ProcInfo),
@@ -202,11 +192,11 @@
 
     % Write progress message for the start of analysing current procedure.
     Run = ss_fixpoint_table_which_run(!.FixpointTable),
-    TabledAsDescr = ss_fixpoint_table_get_short_description(
-        PredProcId, !.FixpointTable),
+    TabledAsDescr = ss_fixpoint_table_get_short_description(PredProcId,
+        !.FixpointTable),
     passes_aux.write_proc_progress_message(
-        "% Sharing analysis (run " ++ string.int_to_string(Run) ++
-        ") ", PredId, ProcId, ModuleInfo, !IO),
+        "% Sharing analysis (run " ++ string.int_to_string(Run) ++ ") ",
+        PredId, ProcId, ModuleInfo, !IO),
 
     % In some cases the sharing can be predicted to be bottom, in which 
     % case a full sharing analysis is not needed.
@@ -219,8 +209,7 @@
     ;
         % Start analysis.
         proc_info_goal(ProcInfo, Goal), 
-        analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable,
-            Goal, 
+        analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable, Goal,
             !FixpointTable, Sharing0, Sharing1, !IO),
         FullAsDescr = short_description(Sharing1), 
 
@@ -245,8 +234,8 @@
 
         Sharing = Sharing3
     ),
-    ss_fixpoint_table_new_as(ModuleInfo, ProcInfo, PredProcId, 
-        Sharing, !FixpointTable),
+    ss_fixpoint_table_new_as(ModuleInfo, ProcInfo, PredProcId, Sharing,
+        !FixpointTable),
     
     maybe_write_string(Verbose, "\t\t (ft = " ++ 
         ss_fixpoint_table_description(!.FixpointTable) ++
@@ -256,15 +245,23 @@
     sharing_as_table::in, hlds_goal::in, ss_fixpoint_table::in, 
     ss_fixpoint_table::out, sharing_as::in, sharing_as::out, 
     io::di, io::uo) is det.
+
 analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable, Goal, 
     !FixpointTable, !SharingAs, !IO) :- 
     Goal = GoalExpr - GoalInfo, 
-
     (
-        GoalExpr = conj(Goals),
+        GoalExpr = conj(ConjType, Goals),
+        (
+            ConjType = plain_conj,
         list.foldl3(analyse_goal(ModuleInfo, PredInfo, ProcInfo, 
-            SharingTable), Goals, !FixpointTable, !SharingAs,
-            !IO)
+                SharingTable), Goals, !FixpointTable, !SharingAs, !IO)
+        ;
+            ConjType = parallel_conj,
+            goal_info_get_context(GoalInfo, Context),
+            context_to_string(Context, ContextString),
+            !:SharingAs = top_sharing("par_conj (" ++ ContextString ++ ")",
+                !.SharingAs)
+        )
     ;
         GoalExpr = call(CalledPredId, CalledProcId, Args, _, _, _),
         CalledPredProcId = proc(CalledPredId, CalledProcId),
@@ -287,7 +284,7 @@
         GoalExpr = generic_call(_GenDetails, _, _, _),
         goal_info_get_context(GoalInfo, Context), 
         context_to_string(Context, ContextString), 
-        !:SharingAs = top_sharing( "generic call (" ++ 
+        !:SharingAs = top_sharing("generic call (" ++
             ContextString ++ ")", !.SharingAs)
     ;
         GoalExpr = switch(_, _, Cases),
@@ -300,7 +297,6 @@
         GoalExpr = unify(_, _, _, Unification, _),
         !:SharingAs = add(ModuleInfo, ProcInfo, Unification, GoalInfo, 
             !.SharingAs)
-
     ;
         GoalExpr = disj(Goals),
         SharingBase = !.SharingAs, 
@@ -319,25 +315,21 @@
         GoalExpr = not(_Goal)
         % XXX Check theory, but a negated goal can not create bindings,
         % hence it also can not create additional sharing.
-
     ;
         GoalExpr = scope(_, _),
         % XXX Check theory, check meaing of "scope/2" goal.
         goal_info_get_context(GoalInfo, Context), 
         context_to_string(Context, ContextString), 
-        !:SharingAs = top_sharing("scope (" ++ ContextString ++ 
-            ")", !.SharingAs)
-
+        !:SharingAs = top_sharing("scope (" ++ ContextString ++ ")",
+            !.SharingAs)
     ;
         GoalExpr = if_then_else(_, IfGoal, ThenGoal, ElseGoal),
         analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable, 
             IfGoal, !FixpointTable, !.SharingAs, IfSharingAs, !IO),
         analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable, 
-            ThenGoal, !FixpointTable, IfSharingAs, ThenSharingAs,
-            !IO),
+            ThenGoal, !FixpointTable, IfSharingAs, ThenSharingAs, !IO),
         analyse_goal(ModuleInfo, PredInfo, ProcInfo, SharingTable, 
-            ElseGoal, !FixpointTable, !.SharingAs, ElseSharingAs,
-            !IO),
+            ElseGoal, !FixpointTable, !.SharingAs, ElseSharingAs, !IO),
         !:SharingAs = least_upper_bound(ModuleInfo, ProcInfo, 
             ThenSharingAs, ElseSharingAs)
     ;
@@ -350,23 +342,15 @@
         !:SharingAs = top_sharing("foreign_proc not handles yet (" 
                 ++ ContextString ++ ")", !.SharingAs)
     ;
-        GoalExpr = par_conj(_),
-        goal_info_get_context(GoalInfo, Context), 
-        context_to_string(Context, ContextString), 
-        !:SharingAs = top_sharing("par_conj (" ++ ContextString ++ 
-            ")", !.SharingAs)
-
-    ;
         GoalExpr = shorthand(_),
         unexpected(this_file, "analyse_goal: shorthand goal.")
     ).
 
-
 :- pred analyse_case(module_info::in, pred_info::in, proc_info::in, 
     sharing_as_table::in, sharing_as::in, case::in, 
     ss_fixpoint_table::in, ss_fixpoint_table::out, 
-    sharing_as::in, sharing_as::out, 
-    io::di, io::uo) is det.
+    sharing_as::in, sharing_as::out, io::di, io::uo) is det.
+
 analyse_case(ModuleInfo, PredInfo, ProcInfo, SharingTable, Sharing0, 
     Case, !FixpointTable, !Sharing, !IO) :- 
     Case = case(_, Goal), 
@@ -388,6 +372,7 @@
     % 4 - react appropriately if the calls happen to be to 
     %     * either compiler generated predicates
     %     * or predicates from builtin.m and private_builtin.m
+    %
 :- pred lookup_sharing(module_info::in, sharing_as_table::in, pred_proc_id::in,
     ss_fixpoint_table::in, ss_fixpoint_table::out, sharing_as::out) is det.
 
@@ -395,8 +380,7 @@
     SharingAs) :- 
     (
         % 1 -- check fixpoint table
-        ss_fixpoint_table_get_as(PredProcId, SharingAs0, 
-            !FixpointTable)
+        ss_fixpoint_table_get_as(PredProcId, SharingAs0, !FixpointTable)
     -> 
         SharingAs = SharingAs0
     ;
@@ -470,14 +454,12 @@
         int_to_string(pred_id_to_int(PredId)) ++ "," ++
         int_to_string(proc_id_to_int(ProcId))).
     
-
 %-----------------------------------------------------------------------------%
 
     % Predicate succeeds if the sharing of a procedure can safely be 
     % approximated by "bottom", simply by looking at the modes and
     % types of the arguments. 
     %
-    %
 :- pred bottom_sharing_is_safe_approximation(module_info::in, 
     proc_info::in) is semidet.  
 
@@ -494,8 +476,7 @@
             Pair = Mode - Type,
 
             % mode is not unique nor clobbered.
-            mode_get_insts(ModuleInfo, Mode, _LeftInst, 
-                RightInst), 
+            mode_get_insts(ModuleInfo, Mode, _LeftInst, RightInst),
             \+ inst_is_unique(ModuleInfo, RightInst),
             \+ inst_is_clobbered(ModuleInfo, RightInst),
 
@@ -546,6 +527,7 @@
 :- pred ss_fixpoint_table_stable(ss_fixpoint_table::in) is semidet.
 
     % Give a string description of the state of the fixpoint table. 
+    %
 :- func ss_fixpoint_table_description(ss_fixpoint_table) = string.
 
     % Enter the newly computed structure sharing description for a given
@@ -553,11 +535,12 @@
     % already stored for that procedure, the stability of the fixpoint
     % table is set to "unstable". 
     % Software error if the procedure is not in the fixpoint table. 
+    %
 :- pred ss_fixpoint_table_new_as(module_info::in, proc_info::in, 
     pred_proc_id::in, sharing_as::in, 
     ss_fixpoint_table::in, ss_fixpoint_table::out) is det.
 
-    % Retreive the structure sharing description for a given pred_proc_id.
+    % Retrieve the structure sharing description for a given pred_proc_id.
     %
     % If the id is part of the fixpoint table, but does not yet record any
     % sharing information about that pred_proc_id, then this means that the
@@ -575,18 +558,20 @@
     % Retreive the structure sharing information without changing the
     % table. To be used after fixpoint has been reached. 
     % Software error if the procedure is not in the table.
+    %
 :- func ss_fixpoint_table_get_final_as(pred_proc_id, 
     ss_fixpoint_table) = sharing_as. 
 
     % Same as ss_fixpoint_table_get_final_as, yet fails instead of aborting
     % if the procedure is not in the table.
+    %
 :- func ss_fixpoint_table_get_final_as_semidet(pred_proc_id,
     ss_fixpoint_table) = sharing_as is semidet. 
 
-
 %-----------------------------------------------------------------------------%
 
 :- func wrapped_init(pred_proc_id) = sharing_as. 
+
 wrapped_init(_Id) = structure_sharing.domain.init. 
 
 ss_fixpoint_table_init(Keys) = fixpoint_table.init(wrapped_init, Keys).
@@ -658,13 +643,13 @@
 :- pred write_proc_sharing_info(pred_id::in, proc_id::in, proc_table::in, 
     pred_or_func::in, sym_name::in, prog_context::in, tvarset::in, 
     io::di, io::uo) is det.
+
 write_proc_sharing_info(_PredId, ProcId, ProcTable, PredOrFunc, SymName, 
     Context, TypeVarSet, !IO) :- 
     globals.io_lookup_bool_option(structure_sharing_analysis, 
         SharingAnalysis, !IO), 
     (
-        SharingAnalysis = yes
-    -> 
+        SharingAnalysis = yes,
         map.lookup(ProcTable, ProcId, ProcInfo),
         proc_info_get_structure_sharing(ProcInfo, MaybeSharingAs), 
         proc_info_declared_argmodes(ProcInfo, Modes),   
@@ -676,11 +661,15 @@
             Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet), 
             MaybeSharingAs, !IO)
     ;
-        true
+        SharingAnalysis = no
     ).
 
 %-----------------------------------------------------------------------------%
+
 :- func this_file = string.
+
 this_file = "structure_sharing.analysis.m".
 
+%-----------------------------------------------------------------------------%
 :- end_module transform_hlds.ctgc.structure_sharing.analysis.
+%-----------------------------------------------------------------------------%
Index: compiler/superhomogeneous.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/superhomogeneous.m,v
retrieving revision 1.12
diff -u -b -r1.12 superhomogeneous.m
--- compiler/superhomogeneous.m	23 Feb 2006 09:37:09 -0000	1.12
+++ compiler/superhomogeneous.m	24 Feb 2006 01:44:38 -0000
@@ -759,12 +759,12 @@
         illegal_state_var_func_result(PredOrFunc, Args0, StateVar)
     ->
         report_illegal_func_svar_result(Context, !.VarSet, StateVar, !IO),
-        true_goal(Goal)
+        Goal = true_goal
     ;
         lambda_args_contain_bang_state_var(Args0, StateVar)
     ->
         report_illegal_bang_svar_lambda_arg(Context, !.VarSet, StateVar, !IO),
-        true_goal(Goal)
+        Goal = true_goal
     ;
         prepare_for_lambda(!SInfo),
         substitute_state_var_mappings(Args0, Args, !VarSet, !SInfo, !IO),
@@ -797,7 +797,7 @@
         % the lambda expression; those corresponding to args whose mode
         % is input or unused.
         %
-        hlds_goal.true_goal(HeadBefore0),
+        HeadBefore0 = true_goal,
         insert_arg_unifications(NonOutputLambdaVars, NonOutputArgs,
             Context, ArgContext, HeadBefore0, HeadBefore, !VarSet,
             !ModuleInfo, !QualInfo, !SInfo, !IO),
@@ -806,7 +806,7 @@
         % the lambda expression; those corresponding to args whose mode
         % is output.
         %
-        hlds_goal.true_goal(HeadAfter0),
+        HeadAfter0 = true_goal,
         insert_arg_unifications(OutputLambdaVars, OutputArgs,
             Context, ArgContext, HeadAfter0, HeadAfter, !VarSet,
             !ModuleInfo, !QualInfo, !SInfo, !IO),
Index: compiler/switch_detection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/switch_detection.m,v
retrieving revision 1.117
diff -u -b -r1.117 switch_detection.m
--- compiler/switch_detection.m	23 Feb 2006 09:37:09 -0000	1.117
+++ compiler/switch_detection.m	24 Feb 2006 02:24:32 -0000
@@ -194,15 +194,17 @@
                 VarTypes, NonLocalsList, ModuleInfo, [], Goal, !Requant)
         )
     ;
-        Goal0 = conj(Goals0),
-        detect_switches_in_conj(ModuleInfo, VarTypes, InstMap0, Goals0, Goals,
-            !Requant),
-        Goal = conj(Goals)
+        Goal0 = conj(ConjType, Goals0),
+        (
+            ConjType = plain_conj,
+            detect_switches_in_conj(ModuleInfo, VarTypes, InstMap0,
+                Goals0, Goals, !Requant)
     ;
-        Goal0 = par_conj(Goals0),
+            ConjType = parallel_conj,
         detect_switches_in_par_conj(ModuleInfo, VarTypes, InstMap0,
-            Goals0, Goals, !Requant),
-        Goal = par_conj(Goals)
+                Goals0, Goals, !Requant)
+        ),
+        Goal = conj(ConjType, Goals)
     ;
         Goal0 = not(SubGoal0),
         detect_switches_in_goal(ModuleInfo, VarTypes, InstMap0,
@@ -460,7 +462,7 @@
 
 expand_sub_disj(Var, Goal, !Cases) :-
     Goal = GoalExpr - GoalInfo,
-    ( GoalExpr = conj(SubGoals) ->
+    ( GoalExpr = conj(plain_conj, SubGoals) ->
         expand_sub_disj_process_conj(Var, SubGoals, [], GoalInfo, !Cases)
     ; GoalExpr = disj(_) ->
         expand_sub_disj_process_conj(Var, [Goal], [], GoalInfo, !Cases)
@@ -500,12 +502,12 @@
     hlds_goal_info::in, hlds_goal::in, hlds_goal::out) is det.
 
 create_expanded_conjunction(Unifies, RestGoals, GoalInfo, Disjunct, Goal) :-
-    ( Disjunct = conj(DisjunctGoals) - _ ->
+    ( Disjunct = conj(plain_conj, DisjunctGoals) - _ ->
         Conjuncts = Unifies ++ DisjunctGoals ++ RestGoals
     ;
         Conjuncts = Unifies ++ [Disjunct] ++ RestGoals
     ),
-    Goal = conj(Conjuncts) - GoalInfo.
+    Goal = conj(plain_conj, Conjuncts) - GoalInfo.
 
 %-----------------------------------------------------------------------------%
 
@@ -584,11 +586,16 @@
 
 find_bind_var_2(Var, ProcessUnify, Goal0 - GoalInfo, Goal, !Subst, !Result,
         !Info, FoundDeconstruct) :-
-    ( Goal0 = scope(Reason, SubGoal0) ->
+    (
+        Goal0 = scope(Reason, SubGoal0)
+    ->
         find_bind_var_2(Var, ProcessUnify, SubGoal0, SubGoal, !Subst,
             !Result, !Info, FoundDeconstruct),
         Goal = scope(Reason, SubGoal) - GoalInfo
-    ; Goal0 = conj(SubGoals0) ->
+    ;
+        Goal0 = conj(ConjType, SubGoals0),
+        ConjType = plain_conj
+    ->
         (
             SubGoals0 = [],
             Goal = Goal0 - GoalInfo,
@@ -597,9 +604,11 @@
             SubGoals0 = [_ | _],
             conj_find_bind_var(Var, ProcessUnify, SubGoals0, SubGoals,
                 !Subst, !Result, !Info, FoundDeconstruct),
-            Goal = conj(SubGoals) - GoalInfo
+            Goal = conj(ConjType, SubGoals) - GoalInfo
         )
-    ; Goal0 = unify(LHS, RHS, _, UnifyInfo0, _) ->
+    ;
+        Goal0 = unify(LHS, RHS, _, UnifyInfo0, _)
+    ->
         (
             % Check whether the unification is a deconstruction unification
             % on either Var or on a variable aliased to Var.
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.100
diff -u -b -r1.100 table_gen.m
--- compiler/table_gen.m	24 Feb 2006 01:41:54 -0000	1.100
+++ compiler/table_gen.m	24 Feb 2006 01:44:38 -0000
@@ -695,7 +695,7 @@
     InactiveInstmapDelta = bind_vars(OutputVars),
     (
         CodeModel = model_det,
-        InactiveGoalExpr = conj([OrigGoal, MarkInactiveGoal])
+        InactiveGoalExpr = conj(plain_conj, [OrigGoal, MarkInactiveGoal])
     ;
         CodeModel = model_semi,
         goal_info_get_instmap_delta(OrigGoalInfo, InstMapDelta),
@@ -703,8 +703,8 @@
             Unifies, NewVars, Renaming),
         rename_vars_in_goal(Renaming, OrigGoal, RenamedOrigGoal),
 
-        ThenGoalExpr = conj(list__append(Unifies, [MarkInactiveGoal])),
-        list__append([TableTipVar | OutputVars], NewVars, ThenVars),
+        ThenGoalExpr = conj(plain_conj, Unifies ++ [MarkInactiveGoal]),
+        ThenVars = [TableTipVar | OutputVars] ++ NewVars,
         set__list_to_set(ThenVars, ThenNonLocals),
         goal_info_init_hide(ThenNonLocals, InactiveInstmapDelta, Detism,
             purity_impure, Context, ThenGoalInfo),
@@ -720,7 +720,7 @@
             AfterInstMapDelta, multidet, purity_impure, Context,
             AfterGoalInfo),
         AfterGoal = AfterGoalExpr - AfterGoalInfo,
-        FirstGoalExpr = conj([OrigGoal, AfterGoal]),
+        FirstGoalExpr = conj(plain_conj, [OrigGoal, AfterGoal]),
         goal_info_get_nonlocals(OrigGoalInfo, OrigGINonLocals),
         set__insert(OrigGINonLocals, TableTipVar, FirstNonlocals),
         goal_info_set_nonlocals(FirstNonlocals, OrigGoalInfo, FirstGoalInfo),
@@ -743,7 +743,7 @@
         purity_impure, Context, SwitchGoalInfo),
     SwitchGoal = SwitchExpr - SwitchGoalInfo,
 
-    GoalExpr = conj([LookUpGoal, SwitchGoal]),
+    GoalExpr = conj(plain_conj, [LookUpGoal, SwitchGoal]),
     goal_info_init_hide(OrigNonLocals, OrigInstMapDelta, Detism,
         purity_impure, Context, GoalInfo),
     Goal = GoalExpr - GoalInfo.
@@ -925,7 +925,7 @@
     % The case CodeModel = model_non was caught by the code above.
     (
         CodeModel = model_det,
-        InactiveGoalExpr = conj([OrigGoal | SaveAnswerGoals]),
+        InactiveGoalExpr = conj(plain_conj, [OrigGoal | SaveAnswerGoals]),
         goal_info_init_hide(InactiveNonLocals, InactiveInstmapDelta,
             Detism, purity_impure, Context, InactiveGoalInfo),
         InactiveGoal = InactiveGoalExpr - InactiveGoalInfo,
@@ -942,7 +942,7 @@
             Unifies, NewVars, Renaming),
         rename_vars_in_goal(Renaming, OrigGoal, RenamedOrigGoal),
 
-        ThenGoalExpr = conj(list__append(Unifies, SaveAnswerGoals)),
+        ThenGoalExpr = conj(plain_conj, Unifies ++ SaveAnswerGoals),
         list__append([TableTipVar | OutputVars], NewVars, ThenVars),
         set__list_to_set(ThenVars, ThenNonLocals),
         goal_info_init_hide(ThenNonLocals, InactiveInstmapDelta,
@@ -971,7 +971,7 @@
         goal_info_init_hide(InactiveNonLocals, InactiveInstmapDelta, Detism,
             purity_impure, Context, InactiveGoalInfo),
         InactiveGoal = InactiveGoalExpr - InactiveGoalInfo,
-        fail_goal(FailedGoal),
+        FailedGoal = fail_goal,
 
         mercury_table_builtin_module(TB),
         SwitchArms = [
@@ -988,7 +988,7 @@
         Detism, purity_impure, Context, SwitchGoalInfo),
     SwitchGoal = SwitchExpr - SwitchGoalInfo,
 
-    GoalExpr = conj([LookUpGoal, SwitchGoal]),
+    GoalExpr = conj(plain_conj, [LookUpGoal, SwitchGoal]),
     goal_info_init_hide(OrigNonLocals, OrigInstMapDelta, Detism, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo.
@@ -1056,7 +1056,7 @@
         "", MarkCompleteCode, "", impure_code, [],
         ModuleInfo, Context, MarkCompleteGoal),
 
-    OrigSaveExpr = conj([OrigGoal | SaveAnswerGoals]),
+    OrigSaveExpr = conj(plain_conj, [OrigGoal | SaveAnswerGoals]),
     set__insert(OrigNonLocals, RecordVar, OrigSaveNonLocals),
     create_instmap_delta([OrigGoal | SaveAnswerGoals], OrigSaveIMD0),
     instmap_delta_restrict(OrigSaveNonLocals, OrigSaveIMD0, OrigSaveIMD),
@@ -1071,7 +1071,7 @@
         purity_impure, Context, AfterGoalInfo),
     AfterGoal = AfterExpr - AfterGoalInfo,
 
-    OrigSaveAfterExpr = conj([OrigSaveGoal, AfterGoal]),
+    OrigSaveAfterExpr = conj(plain_conj, [OrigSaveGoal, AfterGoal]),
     OrigSaveAfterGoal = OrigSaveAfterExpr - OrigSaveGoalInfo,
 
     InactiveExpr = disj([OrigSaveAfterGoal, MarkCompleteGoal]),
@@ -1095,7 +1095,7 @@
         purity_impure, Context, SwitchGoalInfo),
     SwitchGoal = SwitchExpr - SwitchGoalInfo,
 
-    GoalExpr = conj([LookUpGoal, SwitchGoal]),
+    GoalExpr = conj(plain_conj, [LookUpGoal, SwitchGoal]),
     goal_info_init_hide(OrigNonLocals, OrigInstMapDelta, Detism, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo.
@@ -1264,7 +1264,7 @@
         MaybeProcTableInfo = yes(ProcTableInfo)
     ;
         TableDecl = table_io_proc,
-        true_goal(TableIoDeclGoal),
+        TableIoDeclGoal = true_goal,
         NumberedRestoreVars =
             list__map(project_out_arg_method, SavedOutputVars),
         NumberedSaveVars = list__map(project_out_arg_method, SavedOutputVars),
@@ -1297,7 +1297,8 @@
             [IoStateAssignFromVar - ground(clobbered, none),
             IoStateAssignToVar - ground(unique, none)],
             ModuleInfo, Context, IoStateAssignGoal),
-        RestoreAnswerGoalExpr = conj([RestoreAnswerGoal0, IoStateAssignGoal]),
+        RestoreAnswerGoalExpr = conj(plain_conj,
+            [RestoreAnswerGoal0, IoStateAssignGoal]),
         create_instmap_delta([RestoreAnswerGoal0, IoStateAssignGoal],
             RestoreAnswerInstMapDelta0),
         RestoreAnswerGoal0 = _ - RestoreAnswerGoal0Info,
@@ -1333,7 +1334,7 @@
         CallSaveAnswerGoalList = [LeftBracketGoal, NewGoal,
             RightBracketGoal, TableIoDeclGoal | SaveAnswerGoals]
     ),
-    CallSaveAnswerGoalExpr = conj(CallSaveAnswerGoalList),
+    CallSaveAnswerGoalExpr = conj(plain_conj, CallSaveAnswerGoalList),
     create_instmap_delta(CallSaveAnswerGoalList, CallSaveAnswerInstMapDelta0),
     set__insert(OrigNonLocals, TipVar, CallSaveAnswerNonLocals),
     instmap_delta_restrict(CallSaveAnswerNonLocals,
@@ -1355,7 +1356,7 @@
         purity_impure, Context, GenIfNecGoalInfo),
     GenIfNecGoal = GenIfNecGoalExpr - GenIfNecGoalInfo,
 
-    CheckAndGenAnswerGoalExpr = conj([LookupGoal, GenIfNecGoal]),
+    CheckAndGenAnswerGoalExpr = conj(plain_conj, [LookupGoal, GenIfNecGoal]),
     create_instmap_delta([LookupGoal, GenIfNecGoal],
         CheckAndGenAnswerInstMapDelta0),
     set__insert_list(OrigNonLocals, [TableVar, CounterVar, StartVar],
@@ -1464,7 +1465,7 @@
         SubgoalVar, ModuleInfo, TablingViaExtraArgs, Context,
         !VarTypes, !VarSet, SuspendGoal),
 
-    MainExpr = conj([OrigGoal | SaveAnswerGoals]),
+    MainExpr = conj(plain_conj, [OrigGoal | SaveAnswerGoals]),
     set__insert_list(OrigNonLocals, [SubgoalVar, StatusVar], MainNonLocals),
     create_instmap_delta([OrigGoal | SaveAnswerGoals], MainIMD0),
     instmap_delta_restrict(MainNonLocals, MainIMD0, MainIMD),
@@ -1488,7 +1489,7 @@
     goal_info_add_feature(hide_debug_event, MainGoalInfo, SwitchGoalInfo),
     SwitchGoal = SwitchExpr - SwitchGoalInfo,
 
-    GoalExpr = conj([LookUpGoal, SwitchGoal]),
+    GoalExpr = conj(plain_conj, [LookUpGoal, SwitchGoal]),
     goal_info_init_hide(OrigNonLocals, OrigInstMapDelta, nondet, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo.
@@ -1668,7 +1669,8 @@
         [AnswerBlockArg], RestoreArgs, "", "", RestoreCodeStr,
         impure_code, RestoreInstMapDeltaSrc, ModuleInfo, Context, RestoreGoal),
 
-    GoalExpr = conj(LookupSetupGoals ++ [GetNextAnswerGoal, RestoreGoal]),
+    GoalExpr = conj(plain_conj,
+        LookupSetupGoals ++ [GetNextAnswerGoal, RestoreGoal]),
     goal_info_init(OrigNonLocals, OrigInstMapDelta, Detism, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo,
@@ -1746,7 +1748,7 @@
         Context, !VarTypes, !VarSet, !TableInfo, SaveAnswerGoals),
 
     proc_info_goal(!.ProcInfo, OrigGoal),
-    GoalExpr = conj([PickupGoal, OrigGoal | SaveAnswerGoals]),
+    GoalExpr = conj(plain_conj, [PickupGoal, OrigGoal | SaveAnswerGoals]),
     OrigGoal = _ - OrigGoalInfo,
     goal_info_get_determinism(OrigGoalInfo, Detism),
     set__insert(OrigNonLocals, GeneratorVar, NonLocals),
@@ -1996,7 +1998,7 @@
         attach_call_table_tip(SetupGoal0, SetupGoal),
         list__append(LookupGoals, [SetupGoal], LookupSetupGoals)
     ),
-    GoalExpr = conj(LookupSetupGoals),
+    GoalExpr = conj(plain_conj, LookupSetupGoals),
     Vars = list__map(project_var, NumberedVars),
     set__list_to_set([StatusVar, TableTipVar | Vars], NonLocals),
     goal_info_init_hide(NonLocals, bind_vars([TableTipVar, StatusVar]),
@@ -2051,7 +2053,7 @@
     attach_call_table_tip(SetupGoal0, SetupGoal),
     list__append(LookupPrefixGoals, [SetupGoal], LookupSetupGoals),
 
-    GoalExpr = conj(LookupSetupGoals),
+    GoalExpr = conj(plain_conj, LookupSetupGoals),
     Vars = list__map(project_var, NumberedVars),
     set__list_to_set([StatusVar, RecordVar | Vars], NonLocals),
     goal_info_init_hide(NonLocals, bind_vars([RecordVar, StatusVar]),
@@ -2117,7 +2119,7 @@
             attach_call_table_tip(SetupGoal0, SetupGoal),
         list__append(LookupGoals, [SetupGoal], LookupSetupGoals)
     ),
-    GoalExpr = conj(LookupSetupGoals),
+    GoalExpr = conj(plain_conj, LookupSetupGoals),
     Vars = list__map(project_var, NumberedVars),
     set__list_to_set([StatusVar, SubgoalVar | Vars], NonLocals),
     goal_info_init_hide(NonLocals, bind_vars([SubgoalVar, StatusVar]),
@@ -2749,7 +2751,7 @@
             generate_call(GetPredName, det, [TipVar, RestoreBlockVar],
                 semipure_code, ground_vars([RestoreBlockVar]),
                 ModuleInfo, Context, GetBlockGoal),
-            GoalExpr = conj([GetBlockGoal | RestoreGoals]),
+            GoalExpr = conj(plain_conj, [GetBlockGoal | RestoreGoals]),
             set__list_to_set([TipVar | OutputVars], NonLocals),
             goal_info_init_hide(NonLocals, OrigInstMapDelta,
                 det, purity_semipure, Context, GoalInfo),
@@ -2757,7 +2759,7 @@
         )
     ;
         NumberedOutputVars = [],
-        true_goal(Goal)
+        Goal = true_goal
     ).
 
     % Generate a goal for restoring the output arguments from
@@ -2796,7 +2798,7 @@
         Args, RestoreArgs, "", ShortcutStr, RestoreCodeStr, impure_code,
         RestoreInstMapDeltaSrc, ModuleInfo, Context, ShortcutGoal),
 
-    GoalExpr = conj([ReturnAnswerBlocksGoal, ShortcutGoal]),
+    GoalExpr = conj(plain_conj, [ReturnAnswerBlocksGoal, ShortcutGoal]),
     set__list_to_set([RecordVar | OutputVars], NonLocals),
     goal_info_init_hide(NonLocals, OrigInstMapDelta, Detism, purity_semipure,
         Context, GoalInfo),
@@ -2876,10 +2878,10 @@
             tabling_c_attributes, Args, RestoreArgs, "", ShortcutStr,
             RestoreCodeStr, impure_code, RestoreInstMapDeltaSrc, ModuleInfo,
             Context, ShortcutGoal),
-        GoalExpr = conj([ReturnAnswerBlocksGoal, ShortcutGoal])
+        GoalExpr = conj(plain_conj, [ReturnAnswerBlocksGoal, ShortcutGoal])
     ;
         TablingViaExtraArgs = no,
-        GoalExpr = conj([ReturnAnswerBlocksGoal | RestoreGoals])
+        GoalExpr = conj(plain_conj, [ReturnAnswerBlocksGoal | RestoreGoals])
     ),
     set__list_to_set([SubgoalVar | OutputVars], NonLocals),
     goal_info_init_hide(NonLocals, OrigInstMapDelta, Detism, Purity,
@@ -2978,7 +2980,7 @@
     generate_call("table_error", erroneous, [MessageVar], pure_code, [],
         ModuleInfo, Context, CallGoal),
 
-    GoalExpr = conj([MessageStrGoal, CallGoal]),
+    GoalExpr = conj(plain_conj, [MessageStrGoal, CallGoal]),
     goal_info_init_hide(set__init, bind_vars([]), erroneous, purity_impure,
         Context, GoalInfo),
     Goal = GoalExpr - GoalInfo.
@@ -3054,8 +3056,7 @@
     instmap_delta_init_unreachable(UnreachInstMapDelta),
     goal_info_init_hide(NonLocals, UnreachInstMapDelta, failure, purity_impure,
         Context, ConjGoalInfo),
-    fail_goal(FailGoal),
-    GoalAndThenFail = conj([Goal, FailGoal]) - ConjGoalInfo.
+    GoalAndThenFail = conj(plain_conj, [Goal, fail_goal]) - ConjGoalInfo.
 
 :- pred gen_int_construction(string::in, int::in,
     vartypes::in, vartypes::out, prog_varset::in, prog_varset::out,
Index: compiler/term_constr_build.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_build.m,v
retrieving revision 1.3
diff -u -b -r1.3 term_constr_build.m
--- compiler/term_constr_build.m	28 Nov 2005 04:11:56 -0000	1.3
+++ compiler/term_constr_build.m	18 Feb 2006 05:58:02 -0000
@@ -393,7 +393,9 @@
 :- pred build_abstract_goal_2(hlds_goal::in, abstract_goal::out, 
     traversal_info::in, traversal_info::out) is det.
 
-build_abstract_goal_2(conj(Goals) - _, AbstractGoal, !Info) :-
+build_abstract_goal_2(conj(_, Goals) - _, AbstractGoal, !Info) :-
+    % For the purposes of termination analysis there is no 
+    % distinction between parallel conjunctions and normal ones.
     build_abstract_conj(Goals, AbstractGoal, !Info).
 
 build_abstract_goal_2(disj(Goals) - _, AbstractGoal, !Info) :-
@@ -498,12 +500,6 @@
     % 
 build_abstract_goal_2(shorthand(_) - _, _, _, _) :- 
     unexpected(this_file, "shorthand/1 goal during termination analysis.").
-
-    % For the purposes of termination analysis there is no 
-    % distinction between parallel conjunctions and normal ones.
-    %
-build_abstract_goal_2(par_conj(Goals) - _, AbstractGoal, !Info) :-
-    build_abstract_conj(Goals, AbstractGoal, !Info).
 
 %------------------------------------------------------------------------------%
 %
Index: compiler/term_pass1.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_pass1.m,v
retrieving revision 1.26
diff -u -b -r1.26 term_pass1.m
--- compiler/term_pass1.m	1 Feb 2006 05:10:36 -0000	1.26
+++ compiler/term_pass1.m	18 Feb 2006 06:04:49 -0000
@@ -322,8 +322,7 @@
 
 check_goal_expr_non_term_calls(PPId, VarTypes, Goal, _, !Errors,
         !ModuleInfo, !IO):-
-    ( Goal = conj(Goals)
-    ; Goal = par_conj(Goals)
+    ( Goal = conj(_, Goals)
     ; Goal = disj(Goals)
     ),
     list.foldl3(check_goal_non_term_calls(PPId, VarTypes), Goals,
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.44
diff -u -b -r1.44 term_traversal.m
--- compiler/term_traversal.m	23 Feb 2006 09:37:10 -0000	1.44
+++ compiler/term_traversal.m	24 Feb 2006 01:44:39 -0000
@@ -182,11 +182,7 @@
         unexpected(this_file, "traverse_goal_2/5: complicated unify.")
     ).
 
-traverse_goal_2(conj(Goals), _, Params, !Info, !ModuleInfo, !IO) :-
-    list.reverse(Goals, RevGoals),
-    traverse_conj(RevGoals, Params, !Info, !ModuleInfo, !IO).
-
-traverse_goal_2(par_conj(Goals), _, Params, !Info, !ModuleInfo, !IO) :-
+traverse_goal_2(conj(_, Goals), _, Params, !Info, !ModuleInfo, !IO) :-
     list.reverse(Goals, RevGoals),
     traverse_conj(RevGoals, Params, !Info, !ModuleInfo, !IO).
 
Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.9
diff -u -b -r1.9 trailing_analysis.m
--- compiler/trailing_analysis.m	23 Feb 2006 09:37:10 -0000	1.9
+++ compiler/trailing_analysis.m	24 Feb 2006 01:44:39 -0000
@@ -466,11 +466,7 @@
         ( Result0 = conditional ; Result0 = may_modify_trail),
         Result = may_modify_trail
     ).
-check_goal_for_trail_mods_2(SCC, VarTypes, conj(Goals), _,
-        Result, MaybeAnalysisStatus, !ModuleInfo, !IO) :-
-    check_goals_for_trail_mods(SCC, VarTypes, Goals,
-        Result, MaybeAnalysisStatus, !ModuleInfo, !IO).
-check_goal_for_trail_mods_2(SCC, VarTypes, par_conj(Goals), _,
+check_goal_for_trail_mods_2(SCC, VarTypes, conj(_, Goals), _,
         Result, MaybeAnalysisStatus, !ModuleInfo, !IO) :-
     check_goals_for_trail_mods(SCC, VarTypes, Goals,
         Result, MaybeAnalysisStatus, !ModuleInfo, !IO).
@@ -827,15 +823,10 @@
     module_info::in, module_info::out, io::di, io::uo) is det.
 
 annotate_goal_2(VarTypes, _, !Goal, Status, !ModuleInfo, !IO) :-
-    !.Goal = conj(Conjuncts0),
-    annotate_goal_list(VarTypes, Conjuncts0, Conjuncts, Status, !ModuleInfo,
-        !IO),
-    !:Goal = conj(Conjuncts). 
-annotate_goal_2(VarTypes, _, !Goal, Status, !ModuleInfo, !IO) :-
-    !.Goal = par_conj(Conjuncts0),
+    !.Goal = conj(ConjType, Conjuncts0),
     annotate_goal_list(VarTypes, Conjuncts0, Conjuncts, Status, !ModuleInfo,
         !IO),
-    !:Goal = par_conj(Conjuncts).
+    !:Goal = conj(ConjType, Conjuncts). 
 annotate_goal_2(VarTypes, _, !Goal, Status, !ModuleInfo, !IO) :-
     !.Goal = call(CallPredId, CallProcId, CallArgs, _, _, _),
     CallPPId = proc(CallPredId, CallProcId),
Index: compiler/tupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tupling.m,v
retrieving revision 1.18
diff -u -b -r1.18 tupling.m
--- compiler/tupling.m	23 Feb 2006 09:37:10 -0000	1.18
+++ compiler/tupling.m	24 Feb 2006 02:32:22 -0000
@@ -1080,11 +1080,15 @@
         !CountState) :-
     count_load_stores_in_goal(Goal, CountInfo, !CountState).
 
-count_load_stores_in_goal(conj(Goals) - _GoalInfo, CountInfo, !CountState) :-
-    count_load_stores_in_conj(Goals, CountInfo, !CountState).
-
-count_load_stores_in_goal(par_conj(_) - _, _, !_) :-
-    sorry(this_file, "tupling with parallel conjunctions").
+count_load_stores_in_goal(conj(ConjType, Goals) - _GoalInfo, CountInfo,
+        !CountState) :-
+    (
+        ConjType = plain_conj,
+        count_load_stores_in_conj(Goals, CountInfo, !CountState)
+    ;
+        ConjType = parallel_conj,
+        sorry(this_file, "tupling with parallel conjunctions")
+    ).
 
 count_load_stores_in_goal(disj(Goals) - _GoalInfo, CountInfo, !CountState) :-
     count_load_stores_in_disj(Goals, CountInfo, !CountState).
@@ -1713,16 +1717,18 @@
         !VarSet, !VarTypes, TransformMap) :-
     fix_calls_in_goal(Goal0, Goal, !VarSet, !VarTypes, TransformMap).
 
-fix_calls_in_goal(conj(Goals0) - GoalInfo, conj(Goals) - GoalInfo,
-        !VarSet, !VarTypes, TransformMap) :-
-    fix_calls_in_conj(Goals0, Goals, !VarSet, !VarTypes, TransformMap).
-
-fix_calls_in_goal(par_conj(Goals0) - GoalInfo, par_conj(Goals) - GoalInfo,
-        !VarSet, !VarTypes, TransformMap) :-
+fix_calls_in_goal(conj(ConjType, Goals0) - GoalInfo,
+        conj(ConjType, Goals) - GoalInfo, !VarSet, !VarTypes, TransformMap) :-
+    (
+        ConjType = plain_conj,
+        fix_calls_in_conj(Goals0, Goals, !VarSet, !VarTypes, TransformMap)
+    ;
+        ConjType = parallel_conj,
     % XXX: I am not sure whether parallel conjunctions should be treated
     % with fix_calls_in_goal or fix_calls_in_goal_list.  At any rate,
     % this is untested.
-    fix_calls_in_goal_list(Goals0, Goals, !VarSet, !VarTypes, TransformMap).
+        fix_calls_in_goal_list(Goals0, Goals, !VarSet, !VarTypes, TransformMap)
+    ).
 
 fix_calls_in_goal(disj(Goals0) - GoalInfo, disj(Goals) - GoalInfo,
         !VarSet, !VarTypes, TransformMap) :-
@@ -1753,7 +1759,7 @@
 fix_calls_in_conj([Goal0 | Goals0], Goals, !VarSet, !VarTypes, TransformMap) :-
     fix_calls_in_goal(Goal0, Goal1, !VarSet, !VarTypes, TransformMap),
     fix_calls_in_conj(Goals0, Goals1, !VarSet, !VarTypes, TransformMap),
-    ( Goal1 = conj(ConjGoals) - _ ->
+    ( Goal1 = conj(plain_conj, ConjGoals) - _ ->
         Goals = ConjGoals ++ Goals1
     ;
         Goals = [Goal1 | Goals1]
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.386
diff -u -b -r1.386 typecheck.m
--- compiler/typecheck.m	23 Feb 2006 09:37:10 -0000	1.386
+++ compiler/typecheck.m	24 Feb 2006 02:24:47 -0000
@@ -640,7 +640,7 @@
 
     % Combine the unification and call into a conjunction.
     goal_info_init(Context, GoalInfo),
-    Body = conj([UnifyGoal, CallGoal]) - GoalInfo,
+    Body = conj(plain_conj, [UnifyGoal, CallGoal]) - GoalInfo,
     StubClause = clause([], Body, mercury, Context).
 
 :- pred rename_instance_method_constraints(tvar_renaming::in,
@@ -1232,14 +1232,10 @@
     hlds_goal_info::in, typecheck_info::in, typecheck_info::out,
     io::di, io::uo) is det.
 
-typecheck_goal_2(conj(List0), conj(List), _, !Info, !IO) :-
+typecheck_goal_2(conj(ConjType, List0), conj(ConjType, List), _, !Info, !IO) :-
     checkpoint("conj", !Info, !IO),
     typecheck_goal_list(List0, List, !Info, !IO).
 
-typecheck_goal_2(par_conj(List0), par_conj(List), _, !Info, !IO) :-
-    checkpoint("par_conj", !Info, !IO),
-    typecheck_goal_list(List0, List, !Info, !IO).
-
 typecheck_goal_2(disj(List0), disj(List), _, !Info, !IO) :-
     checkpoint("disj", !Info, !IO),
     typecheck_goal_list(List0, List, !Info, !IO).
@@ -1268,7 +1264,7 @@
     ;
         Reason = promise_purity(_, _)
     ;
-        Reason = promise_equivalent_solutions(Vars),
+        Reason = promise_solutions(Vars, _),
         ensure_vars_have_a_type(Vars, !Info, !IO)
     ;
         Reason = commit(_)
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.158
diff -u -b -r1.158 unify_proc.m
--- compiler/unify_proc.m	28 Nov 2005 04:11:58 -0000	1.158
+++ compiler/unify_proc.m	18 Feb 2006 04:54:41 -0000
@@ -716,7 +716,7 @@
 
         Any = any(shared),
         generate_cast(equiv_type_cast, X0, X, Any, Any, Context, CastGoal),
-        Goal = conj([InitGoal, CastGoal]) - GoalInfo,
+        Goal = conj(plain_conj, [InitGoal, CastGoal]) - GoalInfo,
         quantify_clauses_body([X], Goal, Context, Clauses, !Info)
     ;
         unexpected(this_file, "generate_initialise_clauses: " ++
@@ -746,7 +746,7 @@
                 quantify_clauses_body([H1, H2], Goal, Context, Clauses, !Info)
             ;
                 EnumDummy = is_dummy,
-                true_goal(Context, Goal),
+                Goal = true_goal_with_context(Context),
                 % XXX check me
                 quantify_clauses_body([H1, H2], Goal, Context, Clauses, !Info)
             ;
@@ -881,7 +881,7 @@
 
         create_atomic_complicated_unification(ResultVar, equal_functor,
             Context, explicit, [], UnifyGoal),
-        Goal = conj([CallGoal, UnifyGoal]) - GoalInfo
+        Goal = conj(plain_conj, [CallGoal, UnifyGoal]) - GoalInfo
     ;
         unexpected(this_file, "generate_user_defined_unify_clauses")
     ),
@@ -1582,7 +1582,7 @@
 
     build_call("compare_error", [], Context, Abort, !Info),
 
-    Goal = conj([
+    Goal = conj(plain_conj, [
         Call_X_Index,
         Call_Y_Index,
         if_then_else([], Call_Less_Than, Return_Less_Than,
@@ -1786,7 +1786,8 @@
 
         create_atomic_complicated_unification(R, var(R1),
             Context, explicit, [], Return_R1),
-        Condition = conj([Do_Comparison, Check_Not_Equal]) - GoalInfo,
+        Condition = conj(plain_conj, [Do_Comparison, Check_Not_Equal])
+            - GoalInfo,
         compare_args_2(ArgTypes, ExistQTVars, Xs, Ys, R, Context, ElseCase,
             !Info),
         Goal = if_then_else([], Condition, Return_R1, ElseCase) - GoalInfo
@@ -1920,7 +1921,7 @@
         info_get_module_info(!.Info, ModuleInfo),
         is_dummy_argument_type(ModuleInfo, Type)
     ->
-        true_goal(Goal)
+        Goal = true_goal
     ;
         % When unifying existentially typed arguments, the arguments may have
         % different types; in that case, rather than just unifying them,
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.104
diff -u -b -r1.104 unique_modes.m
--- compiler/unique_modes.m	23 Feb 2006 09:37:11 -0000	1.104
+++ compiler/unique_modes.m	24 Feb 2006 02:24:54 -0000
@@ -250,7 +250,10 @@
     hlds_goal_expr::out, mode_info::in, mode_info::out,
     io::di, io::uo) is det.
 
-check_goal_2(conj(List0), _GoalInfo0, conj(List), !ModeInfo, !IO) :-
+check_goal_2(conj(ConjType, List0), GoalInfo0, conj(ConjType, List),
+        !ModeInfo, !IO) :-
+    (
+        ConjType = plain_conj,
     mode_checkpoint(enter, "conj", !ModeInfo, !IO),
     (
         List0 = [],
@@ -261,20 +264,21 @@
         mode_info_add_goals_live_vars(List0, !ModeInfo),
         check_conj(List0, List, !ModeInfo, !IO)
     ),
-    mode_checkpoint(exit, "conj", !ModeInfo, !IO).
-
-check_goal_2(par_conj(List0), GoalInfo0, par_conj(List), !ModeInfo, !IO) :-
+        mode_checkpoint(exit, "conj", !ModeInfo, !IO)
+    ;
+        ConjType = parallel_conj,
     mode_checkpoint(enter, "par_conj", !ModeInfo, !IO),
     goal_info_get_nonlocals(GoalInfo0, NonLocals),
     mode_info_add_live_vars(NonLocals, !ModeInfo),
-    % Build a multiset of the nonlocals of the conjuncts so that we can figure
-    % out which variables must be made shared at the start of the parallel
-    % conjunction.
+        % Build a multiset of the nonlocals of the conjuncts so that we can
+        % figure out which variables must be made shared at the start of the
+        % parallel conjunction.
     make_par_conj_nonlocal_multiset(List0, NonLocalsBag),
     check_par_conj(List0, NonLocalsBag, List, InstMapList, !ModeInfo, !IO),
     instmap__unify(NonLocals, InstMapList, !ModeInfo),
     mode_info_remove_live_vars(NonLocals, !ModeInfo),
-    mode_checkpoint(exit, "par_conj", !ModeInfo, !IO).
+        mode_checkpoint(exit, "par_conj", !ModeInfo, !IO)
+    ).
 
 check_goal_2(disj(List0), GoalInfo0, disj(List), !ModeInfo, !IO) :-
     mode_checkpoint(enter, "disj", !ModeInfo, !IO),
@@ -370,7 +374,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having unique mode information.
-        true_goal(Then),
+        Then = true_goal,
         InstMapThen = InstMapCond
     ),
     mode_info_set_instmap(InstMap0, !ModeInfo),
@@ -632,7 +636,7 @@
 check_conj([], [], !ModeInfo, !IO).
 check_conj([Goal0 | Goals0], Goals, !ModeInfo, !IO) :-
     (
-        Goal0 = conj(ConjGoals) - _
+        Goal0 = conj(plain_conj, ConjGoals) - _
     ->
         list__append(ConjGoals, Goals0, Goals1),
         check_conj(Goals1, Goals, !ModeInfo, !IO)
@@ -804,7 +808,7 @@
         % We should not mode-analyse the goal, since it is unreachable.
         % Instead we optimize the goal away, so that later passes
         % won't complain about it not having unique mode information.
-        true_goal(Goal1)
+        Goal1 = true_goal
     ),
 
     mode_info_get_instmap(!.ModeInfo, InstMap),
Index: compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.28
diff -u -b -r1.28 unneeded_code.m
--- compiler/unneeded_code.m	28 Nov 2005 04:11:59 -0000	1.28
+++ compiler/unneeded_code.m	24 Feb 2006 02:32:37 -0000
@@ -253,11 +253,11 @@
 %
 % The first phase traverses the procedure body, keeping track of which
 % variables are needed where. When it finds a goal that can be deleted,
-% it deletes it by replacing it with the goal `true' (i.e. conj([])).
-% When it finds a goal that can be moved, it does the same, but also
-% records in the RefinedGoalsMap that the deleted goal must later be
-% inserted at the starts of the branches where its outputs may be needed,
-% and accordingly notes that its own inputs are needed in those branches.
+% it deletes it by replacing it with the goal `true'. When it finds a goal
+% that can be moved, it does the same, but also records in the RefinedGoalsMap
+% that the deleted goal must later be inserted at the starts of the branches
+% where its outputs may be needed, and accordingly notes that its own inputs
+% are needed in those branches.
 %
 % The second phase traverses the modified problem body, and inserts the
 % goals in the RefinedGoalsMap at the starts of the indicated branches.
@@ -353,7 +353,7 @@
         map__to_assoc_list(Branches, BranchList),
         list__foldl(insert_branch_into_refined_goals(Goal0), BranchList,
             !RefinedGoals),
-        true_goal(Goal),
+        Goal = true_goal,
         !:Changed = yes
     ),
     undemand_virgin_outputs(Goal0, ModuleInfo, InitInstMap,
@@ -465,13 +465,12 @@
             % Do not delete the `true' goal, since deleting it is a no-op,
             % and thus does *not* strictly reduce the number of computation
             % paths on which a subgoal of the procedure body is executed.
-            GoalExpr = conj([])
+            GoalExpr = true_goal_expr
         ;
             !.WhereInfo = branches(BranchMap),
             map__values(BranchMap, BranchArms),
             list__map(set__count, BranchArms, BranchArmCounts),
-            BranchArmCount = list__foldl(int__plus,
-                BranchArmCounts, 0),
+            BranchArmCount = list.foldl(int__plus, BranchArmCounts, 0),
             BranchArmCount > Options ^ copy_limit
 
             % We may also want to add other space time tradeoffs. E.g. if
@@ -599,18 +598,21 @@
         demand_inputs(Goal, ModuleInfo, InitInstMap, everywhere,
             !WhereNeededMap)
     ;
-        GoalExpr0 = par_conj(_),
-        Goal = Goal0,
-        demand_inputs(Goal, ModuleInfo, InitInstMap, everywhere,
-            !WhereNeededMap)
-    ;
-        GoalExpr0 = conj(Conjuncts0),
+        GoalExpr0 = conj(ConjType, Conjuncts0),
+        (
+            ConjType = plain_conj,
         process_conj(Conjuncts0, Conjuncts, InitInstMap, FinalInstMap,
             VarTypes, ModuleInfo, Options, !WhereNeededMap, !RefinedGoals,
             !Changed),
-        GoalExpr = conj(Conjuncts),
+            GoalExpr = conj(plain_conj, Conjuncts),
         Goal = GoalExpr - GoalInfo0
     ;
+            ConjType = parallel_conj,
+            Goal = Goal0,
+            demand_inputs(Goal, ModuleInfo, InitInstMap, everywhere,
+                !WhereNeededMap)
+        )
+    ;
         GoalExpr0 = switch(SwitchVar, CanFail, Cases0),
         (
             Cases0 = [case(_, _ - FirstCaseGoalInfo) | _],
@@ -720,7 +722,7 @@
         ModuleInfo, Options, !WhereNeededMap, !RefinedGoals, !Changed),
     process_rev_bracketed_conj(BracketedGoals, Goals1, VarTypes,
         ModuleInfo, Options, !WhereNeededMap, !RefinedGoals, !Changed),
-    ( true_goal(Goal1) ->
+    ( Goal1 = true_goal_expr - _ ->
         Goals = Goals1
     ;
         Goals = [Goal1 | Goals1]
@@ -895,14 +897,17 @@
         GoalExpr0 = foreign_proc(_, _, _, _, _, _),
         Goal = Goal0
     ;
-        GoalExpr0 = par_conj(_),
-        Goal = Goal0
-    ;
-        GoalExpr0 = conj(Conjuncts0),
+        GoalExpr0 = conj(ConjType, Conjuncts0),
+        (
+            ConjType = plain_conj,
         refine_conj(Conjuncts0, Conjuncts, !RefinedGoals),
-        GoalExpr = conj(Conjuncts),
+            GoalExpr = conj(ConjType, Conjuncts),
         Goal = GoalExpr - GoalInfo0
     ;
+            ConjType = parallel_conj,
+            Goal = Goal0
+        )
+    ;
         GoalExpr0 = switch(SwitchVar, CanFail, Cases0),
         goal_info_get_goal_path(GoalInfo0, GoalPath),
         refine_cases(Cases0, Cases, !RefinedGoals, GoalPath, 1),
@@ -943,8 +948,8 @@
 refine_conj([Goal0 | Goals0], Goals, !RefinedGoals) :-
     refine_goal(Goal0, HeadGoal, !RefinedGoals),
     refine_conj(Goals0, TailGoals, !RefinedGoals),
-    ( HeadGoal = conj(HeadGoals) - _ ->
-        list__append(HeadGoals, TailGoals, Goals)
+    ( HeadGoal = conj(plain_conj, HeadGoals) - _ ->
+        Goals = HeadGoals ++ TailGoals
     ;
         Goals = [HeadGoal | TailGoals]
     ).
Index: compiler/untupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/untupling.m,v
retrieving revision 1.13
diff -u -b -r1.13 untupling.m
--- compiler/untupling.m	23 Feb 2006 09:37:11 -0000	1.13
+++ compiler/untupling.m	24 Feb 2006 02:32:45 -0000
@@ -364,13 +364,14 @@
 :- pred conjoin_goals_keep_detism(hlds_goal::in, hlds_goal::in,
     hlds_goal::out) is det.
 
-conjoin_goals_keep_detism(GoalA, GoalB, conj(GoalList) - GoalInfo) :-
+conjoin_goals_keep_detism(GoalA, GoalB, Goal) :-
     goal_to_conj_list(GoalA, GoalListA),
     goal_to_conj_list(GoalB, GoalListB),
     list__append(GoalListA, GoalListB, GoalList),
     goal_list_determinism(GoalList, Determinism),
     goal_info_init(GoalInfo0),
-    goal_info_set_determinism(Determinism, GoalInfo0, GoalInfo).
+    goal_info_set_determinism(Determinism, GoalInfo0, GoalInfo),
+    Goal = conj(plain_conj, GoalList) - GoalInfo.
 
 :- pred build_untuple_map(list(prog_var)::in, list(list(prog_var))::in,
     untuple_map::in, untuple_map::out) is det.
@@ -545,18 +546,21 @@
     fix_calls_in_goal(Goal0, Goal, !VarSet, !VarTypes, TransformMap,
         ModuleInfo).
 
-fix_calls_in_goal(conj(Goals0) - GoalInfo, conj(Goals) - GoalInfo,
-        !VarSet, !VarTypes, TransformMap, ModuleInfo) :-
+fix_calls_in_goal(conj(ConjType, Goals0) - GoalInfo,
+        conj(ConjType, Goals) - GoalInfo, !VarSet, !VarTypes,
+        TransformMap, ModuleInfo) :-
+    (
+        ConjType = plain_conj,
     fix_calls_in_conj(Goals0, Goals, !VarSet, !VarTypes, TransformMap,
-        ModuleInfo).
-
-fix_calls_in_goal(par_conj(Goals0) - GoalInfo, par_conj(Goals) - GoalInfo,
-        !VarSet, !VarTypes, TransformMap, ModuleInfo) :-
+            ModuleInfo)
+    ;
+        ConjType = parallel_conj,
     % I am not sure whether parallel conjunctions should be treated
     % with fix_calls_in_goal or fix_calls_in_goal_list.  At any rate,
     % this is untested.
     fix_calls_in_goal_list(Goals0, Goals, !VarSet, !VarTypes,
-        TransformMap, ModuleInfo).
+            TransformMap, ModuleInfo)
+    ).
 
 fix_calls_in_goal(disj(Goals0) - GoalInfo, disj(Goals) - GoalInfo,
         !VarSet, !VarTypes, TransformMap, ModuleInfo) :-
@@ -595,7 +599,7 @@
         ModuleInfo),
     fix_calls_in_conj(Goals0, Goals1, !VarSet, !VarTypes, TransformMap,
         ModuleInfo),
-    (if Goal1 = conj(ConjGoals) - _ then
+    (if Goal1 = conj(plain_conj, ConjGoals) - _ then
         Goals = ConjGoals ++ Goals1
     else
         Goals = [Goal1 | Goals1]
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.122
diff -u -b -r1.122 unused_args.m
--- compiler/unused_args.m	24 Feb 2006 01:41:54 -0000	1.122
+++ compiler/unused_args.m	24 Feb 2006 01:44:41 -0000
@@ -622,10 +622,7 @@
 traverse_goal(Info, Goal, !VarDep) :-
     Goal = GoalExpr - _GoalInfo,
     (
-        GoalExpr = conj(Goals),
-        traverse_list_of_goals(Info, Goals, !VarDep)
-    ;
-        GoalExpr = par_conj(Goals),
+        GoalExpr = conj(_ConjType, Goals),
         traverse_list_of_goals(Info, Goals, !VarDep)
     ;
         GoalExpr = disj(Goals),
@@ -1431,14 +1428,9 @@
 
 fixup_goal_expr(GoalExpr0 - GoalInfo0, Goal, !Info, Changed) :-
     (
-        GoalExpr0 = conj(Goals0),
-        fixup_conjuncts(Goals0, Goals, !Info, no, Changed),
-        GoalExpr = conj(Goals),
-        Goal = GoalExpr - GoalInfo0
-    ;
-        GoalExpr0 = par_conj(Goals0),
+        GoalExpr0 = conj(ConjType, Goals0),
         fixup_conjuncts(Goals0, Goals, !Info, no, Changed),
-        GoalExpr = par_conj(Goals),
+        GoalExpr = conj(ConjType, Goals),
         Goal = GoalExpr - GoalInfo0
     ;
         GoalExpr0 = disj(Goals0),
@@ -1490,7 +1482,7 @@
             GoalExpr = GoalExpr0,
             Changed = ChangedPrime
         ;
-            GoalExpr = conj([]),
+            GoalExpr = true_goal_expr,
             Changed = yes
         ),
         Goal = GoalExpr - GoalInfo0
@@ -1563,8 +1555,8 @@
     ;
         LocalChanged = no
     ),
-    % Replacing a goal with conj([]) signals that it is no longer needed.
-    ( Goal = conj([]) - _ ->
+    % Replacing a goal with true signals that it is no longer needed.
+    ( Goal = true_goal_expr - _ ->
         Goals = Goals1
     ;
         Goals = [Goal | Goals1]
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
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
cvs diff: Diffing mdbcomp
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
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
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/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:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list