[m-rev.] for review: aesthetic changes to declarative debugger code

Ian MacLarty maclarty at cs.mu.OZ.AU
Mon Jan 24 21:12:40 AEDT 2005


For review by anyone.

Estimated hours taken: 1.2
Branches: main

In the declarative debugger: use predmode syntax where appropriate; use `.'
as a module qualifier instead of `__'; use state variables for IO instead of
DCGs; use `io' instead of `io.state'.

browser/declarative_debugger.m
browser/declarative_execution.m
browser/declarative_oracle.m
browser/declarative_test.m
browser/declarative_tree.m
browser/declarative_user.m
	Apply the above mentioned changes.

Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.49
diff -u -r1.49 declarative_debugger.m
--- browser/declarative_debugger.m	24 Jan 2005 07:41:03 -0000	1.49
+++ browser/declarative_debugger.m	24 Jan 2005 09:20:38 -0000
@@ -262,8 +262,8 @@
 
 :- type diagnoser_state(R).
 
-:- pred diagnoser_state_init(io_action_map::in, io__input_stream::in,
-	io__output_stream::in, browser_info.browser_persistent_state::in,
+:- pred diagnoser_state_init(io_action_map::in, io.input_stream::in,
+	io.output_stream::in, browser_info.browser_persistent_state::in,
 	diagnoser_state(R)::out) is det.
 
 :- pred diagnosis(S::in, R::in, int::in, int::in, int::in,
@@ -271,7 +271,7 @@
 	diagnoser_state(R)::in, diagnoser_state(R)::out,
 	browser_info.browser_persistent_state::in,
 	browser_info.browser_persistent_state::out,
-	io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
+	io::di, io::uo) is cc_multi <= annotated_trace(S, R).
 
 :- pred unravel_decl_atom(some_decl_atom::in, trace_atom::out,
 	list(io_action)::out) is det.
@@ -297,11 +297,11 @@
 
 :- implementation.
 
-:- import_module mdb__declarative_analyser.
-:- import_module mdb__declarative_edt.
-:- import_module mdb__declarative_oracle.
-:- import_module mdb__declarative_tree.
-:- import_module mdb__util.
+:- import_module mdb.declarative_analyser.
+:- import_module mdb.declarative_edt.
+:- import_module mdb.declarative_oracle.
+:- import_module mdb.declarative_tree.
+:- import_module mdb.util.
 
 :- import_module exception, int, map, bool.
 
@@ -330,9 +330,8 @@
 			oracle_state	:: oracle_state
 		).
 
-:- pred diagnoser_get_analyser(diagnoser_state(R),
-		analyser_state(edt_node(R))).
-:- mode diagnoser_get_analyser(in, out) is det.
+:- pred diagnoser_get_analyser(diagnoser_state(R)::in,
+		analyser_state(edt_node(R))::out) is det.
 
 diagnoser_get_analyser(diagnoser(Analyser, _), Analyser).
 
@@ -342,8 +341,7 @@
 diagnoser_set_analyser(Analyser, diagnoser(_, Oracle), 
 	diagnoser(Analyser, Oracle)).
 
-:- pred diagnoser_get_oracle(diagnoser_state(R), oracle_state).
-:- mode diagnoser_get_oracle(in, out) is det.
+:- pred diagnoser_get_oracle(diagnoser_state(R)::in, oracle_state::out) is det.
 
 diagnoser_get_oracle(diagnoser(_, Oracle), Oracle).
 
@@ -395,7 +393,7 @@
 
 :- pred diagnosis_2(S::in, R::in, diagnoser_state(R)::in,
 	{diagnoser_response(R), diagnoser_state(R)}::out,
-	io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
+	io::di, io::uo) is cc_multi <= annotated_trace(S, R).
 
 diagnosis_2(Store, NodeId, Diagnoser0, {Response, Diagnoser}, !IO) :-
 	Analyser0 = Diagnoser0 ^ analyser_state,
@@ -409,10 +407,10 @@
 :- pred handle_analyser_response(S::in, analyser_response(edt_node(R))::in,
 	maybe(subterm_origin(edt_node(R)))::in, diagnoser_response(R)::out,
 	diagnoser_state(R)::in, diagnoser_state(R)::out, 
-	io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
+	io::di, io::uo) is cc_multi <= annotated_trace(S, R).
 
 handle_analyser_response(_, no_suspects, _, no_bug_found, !Diagnoser, !IO) :-
-	io__write_string("No bug found.\n", !IO).
+	io.write_string("No bug found.\n", !IO).
 
 handle_analyser_response(Store, bug_found(Bug, Evidence), _, Response,
 		!Diagnoser, !IO) :-
@@ -426,9 +424,9 @@
 		MaybeOrigin = yes(Origin),
 		Flag > 0
 	->
-		io__write_string("Origin: ", !IO),
+		io.write_string("Origin: ", !IO),
 		write_origin(wrap(Store), Origin, !IO),
-		io__nl(!IO)
+		io.nl(!IO)
 	;
 		true
 	),
@@ -457,7 +455,7 @@
 
 :- pred handle_oracle_response(S::in, oracle_response(edt_node(R))::in,
 	diagnoser_response(R)::out, diagnoser_state(R)::in,
-	diagnoser_state(R)::out, io__state::di, io__state::uo) 
+	diagnoser_state(R)::out, io::di, io::uo) 
 	is cc_multi <= annotated_trace(S, R).
 
 handle_oracle_response(Store, oracle_answer(Answer), Response, !Diagnoser, 
@@ -476,11 +474,11 @@
 	Response = symptom_found(Event).
 
 handle_oracle_response(_, abort_diagnosis, no_bug_found, !Diagnoser, !IO) :-
-	io__write_string("Diagnosis aborted.\n", !IO).
+	io.write_string("Diagnosis aborted.\n", !IO).
 
 :- pred confirm_bug(S::in, decl_bug::in, decl_evidence(T)::in,
 	diagnoser_response(R)::out, diagnoser_state(R)::in,
-	diagnoser_state(R)::out, io__state::di, io__state::uo) is cc_multi
+	diagnoser_state(R)::out, io::di, io::uo) is cc_multi
 	<= annotated_trace(S, R).
 
 confirm_bug(Store, Bug, Evidence, Response, !Diagnoser, !IO) :-
@@ -500,23 +498,23 @@
 	).
 
 :- pred overrule_bug(S::in, diagnoser_response(R)::out, diagnoser_state(R)::in,
-	diagnoser_state(R)::out, io__state::di, io__state::uo) is cc_multi
+	diagnoser_state(R)::out, io::di, io::uo) is cc_multi
 	<= annotated_trace(S, R).
 
-overrule_bug(Store, Response, Diagnoser0, Diagnoser) -->
-	{ Analyser0 = Diagnoser0 ^ analyser_state },
-	{ revise_analysis(wrap(Store), AnalyserResponse, Analyser0, Analyser) },
-	{ Diagnoser1 = Diagnoser0 ^ analyser_state := Analyser },
-	{ debug_analyser_state(Analyser, MaybeOrigin) },
+overrule_bug(Store, Response, Diagnoser0, Diagnoser, !IO) :-
+	Analyser0 = Diagnoser0 ^ analyser_state,
+	revise_analysis(wrap(Store), AnalyserResponse, Analyser0, Analyser),
+	Diagnoser1 = Diagnoser0 ^ analyser_state := Analyser,
+	debug_analyser_state(Analyser, MaybeOrigin),
 	handle_analyser_response(Store, AnalyserResponse, MaybeOrigin,
-		Response, Diagnoser1, Diagnoser).
+		Response, Diagnoser1, Diagnoser, !IO).
 
 %-----------------------------------------------------------------------------%
 
 	% Export a monomorphic version of diagnosis_state_init/4, to
 	% make it easier to call from C code.
 	%
-:- pred diagnoser_state_init_store(io__input_stream::in, io__output_stream::in,
+:- pred diagnoser_state_init_store(io.input_stream::in, io.output_stream::in,
 	browser_info.browser_persistent_state::in, 
 	diagnoser_state(trace_node_id)::out) is det.
 
@@ -524,7 +522,7 @@
 		"MR_DD_decl_diagnosis_state_init").
 
 diagnoser_state_init_store(InStr, OutStr, Browser, Diagnoser) :-
-	diagnoser_state_init(map__init, InStr, OutStr, Browser, Diagnoser).
+	diagnoser_state_init(map.init, InStr, OutStr, Browser, Diagnoser).
 
 :- pred set_fallback_search_mode(
 	mdb.declarative_analyser.search_mode::in,
@@ -566,8 +564,8 @@
 	diagnoser_state(trace_node_id)::in,
 	diagnoser_state(trace_node_id)::out, 
 	browser_info.browser_persistent_state::in, 
-	browser_info.browser_persistent_state::out, io__state::di, 
-	io__state::uo) is cc_multi.
+	browser_info.browser_persistent_state::out, io::di, io::uo) 
+	is cc_multi.
 
 :- pragma export(diagnosis_store(in, in, in, in, in, out, in, out, in, out, 
 	di, uo), "MR_DD_decl_diagnosis").
@@ -580,32 +578,31 @@
 	% Export some predicates so that C code can interpret the
 	% diagnoser response.
 	%
-:- pred diagnoser_bug_found(diagnoser_response(trace_node_id), event_number).
-:- mode diagnoser_bug_found(in, out) is semidet.
+:- pred diagnoser_bug_found(diagnoser_response(trace_node_id)::in, 
+	event_number::out) is semidet.
 
 :- pragma export(diagnoser_bug_found(in, out), "MR_DD_diagnoser_bug_found").
 
 diagnoser_bug_found(bug_found(Event), Event).
 
-:- pred diagnoser_symptom_found(diagnoser_response(trace_node_id), 
-	event_number).
-:- mode diagnoser_symptom_found(in, out) is semidet.
+:- pred diagnoser_symptom_found(diagnoser_response(trace_node_id)::in, 
+	event_number::out) is semidet.
 
 :- pragma export(diagnoser_symptom_found(in, out),
 	"MR_DD_diagnoser_symptom_found").
 
 diagnoser_symptom_found(symptom_found(Event), Event).
 
-:- pred diagnoser_no_bug_found(diagnoser_response(trace_node_id)).
-:- mode diagnoser_no_bug_found(in) is semidet.
+:- pred diagnoser_no_bug_found(diagnoser_response(trace_node_id)::in)
+	is semidet.
 
 :- pragma export(diagnoser_no_bug_found(in), "MR_DD_diagnoser_no_bug_found").
 
 diagnoser_no_bug_found(no_bug_found).
 
-:- pred diagnoser_require_subtree(diagnoser_response(trace_node_id), 
-	event_number, sequence_number, trace_node_id).
-:- mode diagnoser_require_subtree(in, out, out, out) is semidet.
+:- pred diagnoser_require_subtree(diagnoser_response(trace_node_id)::in, 
+	event_number::out, sequence_number::out, trace_node_id::out) 
+	is semidet.
 
 :- pragma export(diagnoser_require_subtree(in, out, out, out),
 		"MR_DD_diagnoser_require_subtree").
@@ -613,9 +610,8 @@
 diagnoser_require_subtree(require_subtree(Event, SeqNo, CallPreceding), 
 	Event, SeqNo, CallPreceding).
 
-:- pred diagnoser_require_supertree(diagnoser_response(trace_node_id), 
-	event_number, sequence_number).
-:- mode diagnoser_require_supertree(in, out, out) is semidet.
+:- pred diagnoser_require_supertree(diagnoser_response(trace_node_id)::in, 
+	event_number::out, sequence_number::out) is semidet.
 
 :- pragma export(diagnoser_require_supertree(in, out, out),
 		"MR_DD_diagnoser_require_supertree").
@@ -690,12 +686,12 @@
 
 :- pred handle_diagnoser_exception(diagnoser_exception::in,
 	diagnoser_response(R)::out, diagnoser_state(R)::in,
-	diagnoser_state(R)::out, io__state::di, io__state::uo) is det.
+	diagnoser_state(R)::out, io::di, io::uo) is det.
 
 handle_diagnoser_exception(internal_error(Loc, Msg), Response, !Diagnoser, !IO)
 		:-
-	io__stderr_stream(StdErr, !IO),
-	io__write_string(StdErr, "An internal error has occurred; " ++
+	io.stderr_stream(StdErr, !IO),
+	io.write_string(StdErr, "An internal error has occurred; " ++
 		"diagnosis will be aborted.  Debugging\n" ++
 		"message follows:\n" ++ Loc ++ ": " ++ Msg ++ "\n" ++ 
 		"Please report bugs to mercury-bugs at cs.mu.oz.au.\n", !IO),
@@ -705,8 +701,8 @@
 	Response = no_bug_found.
 
 handle_diagnoser_exception(io_error(Loc, Msg), Response, !Diagnoser, !IO) :-
-	io__stderr_stream(StdErr, !IO),
-	io__write_string(StdErr, "I/O error: "++Loc++": "++Msg++".\n"++
+	io.stderr_stream(StdErr, !IO),
+	io.write_string(StdErr, "I/O error: "++Loc++": "++Msg++".\n"++
 		"Diagnosis will be aborted.\n", !IO),
 	% Reset the analyser, in case it was left in an inconsistent state.
 	reset_analyser(!.Diagnoser ^ analyser_state, Analyser),
@@ -715,7 +711,7 @@
 
 handle_diagnoser_exception(unimplemented_feature(Feature), Response, 
 		!Diagnoser, !IO) :-
-	io__write_string("Sorry, the diagnosis cannot continue because "++
+	io.write_string("Sorry, the diagnosis cannot continue because "++
 		"it requires support for\n"++
 		"the following: "++Feature++".\n"++
 		"The debugger is a work in progress, and this is not "++
@@ -727,8 +723,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred decl_bug_get_event_number(decl_bug, event_number).
-:- mode decl_bug_get_event_number(in, out) is det.
+:- pred decl_bug_get_event_number(decl_bug::in, event_number::out) is det.
 
 decl_bug_get_event_number(e_bug(EBug), Event) :-
 	(
@@ -744,7 +739,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred write_origin(wrap(S)::in, subterm_origin(edt_node(R))::in,
-	io__state::di, io__state::uo) is det <= annotated_trace(S, R).
+	io::di, io::uo) is det <= annotated_trace(S, R).
 
 write_origin(wrap(Store), Origin, !IO) :-
 	(Origin = output(dynamic(NodeId), ArgPos, TermPath) ->
@@ -752,15 +747,15 @@
 		ProcId = get_proc_id_from_layout(
 			ExitNode ^ exit_atom ^ proc_layout),
 		ProcName = get_proc_name(ProcId),
-		io__write_string("output(", !IO),
-		io__write_string(ProcName, !IO),
-		io__write_string(", ", !IO),
-		io__write(ArgPos, !IO),
-		io__write_string(", ", !IO),
-		io__write(TermPath, !IO),
-		io__write_string(")", !IO)
+		io.write_string("output(", !IO),
+		io.write_string(ProcName, !IO),
+		io.write_string(", ", !IO),
+		io.write(ArgPos, !IO),
+		io.write_string(", ", !IO),
+		io.write(TermPath, !IO),
+		io.write_string(")", !IO)
 	;
-		io__write(Origin, !IO)
+		io.write(Origin, !IO)
 	).
 
 :- pragma foreign_code("C",
@@ -780,7 +775,7 @@
 extern	int	MR_DD_debug_origin;
 ").
 
-:- pred debug_origin(int::out, io__state::di, io__state::uo) is det.
+:- pred debug_origin(int::out, io::di, io::uo) is det.
 
 :- pragma foreign_proc("C",
 	debug_origin(Flag::out, IO0::di, IO::uo),
@@ -789,5 +784,5 @@
 	Flag = MR_DD_debug_origin;
 	IO = IO0;
 ").
-debug_origin(_) -->
-	{ private_builtin__sorry("declarative_debugger.debug_origin") }.
+debug_origin(_, !IO) :-
+	private_builtin.sorry("declarative_debugger.debug_origin").
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.34
diff -u -r1.34 declarative_execution.m
--- browser/declarative_execution.m	24 Jan 2005 07:41:03 -0000	1.34
+++ browser/declarative_execution.m	24 Jan 2005 10:03:34 -0000
@@ -266,8 +266,7 @@
 		% identifier does not refer to any trace_node (ie.
 		% it is a NULL pointer).
 		%
-	pred trace_node_from_id(S, R, trace_node(R)),
-	mode trace_node_from_id(in, in, out) is semidet
+	pred trace_node_from_id(S::in, R::in, trace_node(R)::out) is semidet
 ].
 
 	% Given any node in an annotated trace, find the most recent
@@ -297,64 +296,64 @@
 	% The following procedures also dereference the identifiers,
 	% but they give an error if the node is not of the expected type.
 	%
-:- pred det_trace_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode det_trace_node_from_id(in, in, out) is det.
+:- pred det_trace_node_from_id(S::in, R::in, trace_node(R)::out) is det
+	<= annotated_trace(S, R).
 
 :- inst trace_node_call ---> call(ground, ground, ground, ground,
 	ground, ground, ground, ground, ground).
 
-:- pred call_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode call_node_from_id(in, in, out(trace_node_call)) is det.
+:- pred call_node_from_id(S::in, R::in, trace_node(R)::out(trace_node_call)) 
+	is det <= annotated_trace(S, R).
 
 :- inst trace_node_redo ---> redo(ground, ground, ground).
 
 	% maybe_redo_node_from_id/3 fails if the argument is a
 	% NULL reference.
 	% 
-:- pred maybe_redo_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode maybe_redo_node_from_id(in, in, out(trace_node_redo)) is semidet.
+:- pred maybe_redo_node_from_id(S::in, R::in, 
+	trace_node(R)::out(trace_node_redo)) is semidet 
+	<= annotated_trace(S, R).
 
 :- inst trace_node_exit ---> exit(ground, ground, ground, ground,
 	ground, ground).
 
-:- pred exit_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode exit_node_from_id(in, in, out(trace_node_exit)) is det.
+:- pred exit_node_from_id(S::in, R::in, trace_node(R)::out(trace_node_exit)) 
+	is det <= annotated_trace(S, R).
 
 :- inst trace_node_cond ---> cond(ground, ground, ground).
 
-:- pred cond_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode cond_node_from_id(in, in, out(trace_node_cond)) is det.
+:- pred cond_node_from_id(S::in, R::in, trace_node(R)::out(trace_node_cond)) 
+	is det <= annotated_trace(S, R).
 
 :- inst trace_node_neg ---> neg(ground, ground, ground).
 
-:- pred neg_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode neg_node_from_id(in, in, out(trace_node_neg)) is det.
+:- pred neg_node_from_id(S::in, R::in, trace_node(R)::out(trace_node_neg)) 
+	is det <= annotated_trace(S, R).
 
 :- inst trace_node_first_disj = bound(first_disj(ground, ground)).
 
-:- pred first_disj_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode first_disj_node_from_id(in, in, out(trace_node_first_disj)) is det.
+:- pred first_disj_node_from_id(S::in, R::in, 
+	trace_node(R)::out(trace_node_first_disj)) is det 
+	<= annotated_trace(S, R).
 
 :- inst trace_node_disj
 	--->	first_disj(ground, ground)
 	;	later_disj(ground, ground, ground).
 
-:- pred disj_node_from_id(S, R, trace_node(R)) <= annotated_trace(S, R).
-:- mode disj_node_from_id(in, in, out(trace_node_disj)) is det.
+:- pred disj_node_from_id(S::in, R::in, trace_node(R)::out(trace_node_disj)) 
+	is det <= annotated_trace(S, R).
 
 	% Load an execution tree which was previously saved by
 	% the back end.
 	%
-:- pred load_trace_node_map(io__input_stream, trace_node_map,
-		trace_node_key, io__state, io__state).
-:- mode load_trace_node_map(in, out, out, di, uo) is det.
+:- pred load_trace_node_map(io.input_stream::in, trace_node_map::out,
+	trace_node_key::out, io::di, io::uo) is det.
 
 	% Save an execution tree generated by the back end.  It is
 	% first converted into a trace_node_map/trace_node_key pair.
 	%
-:- pred save_trace_node_store(io__output_stream, trace_node_store,
-		trace_node_id, io__state, io__state).
-:- mode save_trace_node_store(in, in, in, di, uo) is det.
+:- pred save_trace_node_store(io.output_stream::in, trace_node_store::in,
+	trace_node_id::in, io::di, io::uo) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -398,7 +397,7 @@
 	
 :- implementation.
 
-:- import_module mdb__declarative_debugger.
+:- import_module mdb.declarative_debugger.
 :- import_module int, map, exception, store.
 :- import_module require.
 :- import_module mdb.declarative_edt.
@@ -841,9 +840,8 @@
 	%
 :- type trace_node_id ---> id(c_pointer).
 
-:- pred search_trace_node_store(trace_node_store, trace_node_id,
-		trace_node(trace_node_id)).
-:- mode search_trace_node_store(in, in, out) is semidet.
+:- pred search_trace_node_store(trace_node_store::in, trace_node_id::in,
+	trace_node(trace_node_id)::out) is semidet.
 
 :- pragma foreign_proc("C",
 	search_trace_node_store(_Store::in, Id::in, Node::out),
@@ -854,7 +852,7 @@
 "
 ).
 search_trace_node_store(_, _, _) :-
-	private_builtin__sorry("search_trace_node_store").
+	private_builtin.sorry("search_trace_node_store").
 
 	%
 	% Following are some predicates that are useful for
@@ -876,9 +874,9 @@
 			"not a CALL node"))
 	).
 
-:- func call_node_set_last_interface(trace_node(trace_node_id), trace_node_id)
-		= trace_node(trace_node_id).
-:- mode call_node_set_last_interface(di, di) = out is det.
+:- func call_node_set_last_interface(trace_node(trace_node_id)::di, 
+	trace_node_id::di) = (trace_node(trace_node_id)::out) is det.
+
 :- pragma export(call_node_set_last_interface(di, di) = out,
 		"MR_DD_call_node_set_last_interface").
 
@@ -896,9 +894,9 @@
 		%
 	set_trace_node_arg(Call1, 1, Last, Call).
 
-:- func cond_node_set_status(trace_node(trace_node_id), goal_status)
-		= trace_node(trace_node_id).
-:- mode cond_node_set_status(di, di) = out is det.
+:- func cond_node_set_status(trace_node(trace_node_id)::di, goal_status::di)
+		= (trace_node(trace_node_id)::out) is det.
+
 :- pragma export(cond_node_set_status(di, di) = out,
 		"MR_DD_cond_node_set_status").
 
@@ -915,9 +913,9 @@
 		%
 	set_trace_node_arg(Cond1, 2, Status, Cond).
 
-:- func neg_node_set_status(trace_node(trace_node_id), goal_status)
-		= trace_node(trace_node_id).
-:- mode neg_node_set_status(di, di) = out is det.
+:- func neg_node_set_status(trace_node(trace_node_id)::di, goal_status::di)
+		= (trace_node(trace_node_id)::out) is det.
+
 :- pragma export(neg_node_set_status(di, di) = out,
 		"MR_DD_neg_node_set_status").
 
@@ -934,16 +932,15 @@
 		%
 	set_trace_node_arg(Neg1, 2, Status, Neg).
 
-:- pred set_trace_node_arg(trace_node(trace_node_id), int, T,
-		trace_node(trace_node_id)).
-:- mode set_trace_node_arg(di, in, di, out) is det.
+:- pred set_trace_node_arg(trace_node(trace_node_id)::di, int::in, T::di,
+		trace_node(trace_node_id)::out) is det.
 
 set_trace_node_arg(Node0, FieldNum, Val, Node) :-
-	store__new(S0),
-	store__new_ref(Node0, Ref, S0, S1),
-	store__arg_ref(Ref, FieldNum, ArgRef, S1, S2),
-	store__set_ref_value(ArgRef, Val, S2, S),
-	store__extract_ref_value(S, Ref, Node).
+	store.new(S0),
+	store.new_ref(Node0, Ref, S0, S1),
+	store.arg_ref(Ref, FieldNum, ArgRef, S1, S2),
+	store.set_ref_value(ArgRef, Val, S2, S),
+	store.extract_ref_value(S, Ref, Node).
 
 :- func trace_node_port(trace_node(trace_node_id)) = trace_port.
 :- pragma export(trace_node_port(in) = out,
@@ -990,9 +987,8 @@
 trace_node_path(S, neg_fail(_, Neg)) = P :-
 	neg_node_from_id(S, Neg, neg(_, P, _)).
 
-:- pred trace_node_seqno(trace_node_store, trace_node(trace_node_id),
-		sequence_number).
-:- mode trace_node_seqno(in, in, out) is semidet.
+:- pred trace_node_seqno(trace_node_store::in, trace_node(trace_node_id)::in,
+		sequence_number::out) is semidet.
 
 :- pragma export(trace_node_seqno(in, in, out), "MR_DD_trace_node_seqno").
 
@@ -1019,8 +1015,8 @@
 trace_node_call(_, fail(_, Call, _, _), Call).
 trace_node_call(_, excp(_, Call, _, _, _), Call).
 
-:- pred trace_node_first_disj(trace_node(trace_node_id), trace_node_id).
-:- mode trace_node_first_disj(in, out) is semidet.
+:- pred trace_node_first_disj(trace_node(trace_node_id)::in, 
+	trace_node_id::out) is semidet.
 
 :- pragma export(trace_node_first_disj(in, out),
 		"MR_DD_trace_node_first_disj").
@@ -1063,14 +1059,14 @@
 	% Print a text representation of a trace node, useful
 	% for debugging purposes.
 	%
-:- pred print_trace_node(io__output_stream, trace_node(trace_node_id),
-		io__state, io__state).
-:- mode print_trace_node(in, in, di, uo) is det.
+:- pred print_trace_node(io.output_stream::in, trace_node(trace_node_id)::in,
+		io::di, io::uo) is det.
+
 :- pragma export(print_trace_node(in, in, di, uo), "MR_DD_print_trace_node").
 
-print_trace_node(OutStr, Node) -->
-	{ convert_node(Node, CNode) },
-	io__write(OutStr, CNode).
+print_trace_node(OutStr, Node, !IO) :-
+	convert_node(Node, CNode),
+	io.write(OutStr, CNode, !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -1209,8 +1205,7 @@
 
 construct_neg_fail_node(Preceding, Neg) = neg_fail(Preceding, Neg).
 
-:- pred null_trace_node_id(trace_node_id).
-:- mode null_trace_node_id(out) is det.
+:- pred null_trace_node_id(trace_node_id::out) is det.
 
 :- pragma foreign_proc("C",
 	null_trace_node_id(Id::out),
@@ -1219,14 +1214,14 @@
 ).
 
 null_trace_node_id(_) :-
-	private_builtin__sorry("null_trace_node_id").
+	private_builtin.sorry("null_trace_node_id").
 
 :- func construct_trace_atom(proc_layout, int) = trace_atom.
 :- pragma export(construct_trace_atom(in, in) = out,
 		"MR_DD_construct_trace_atom").
 
 construct_trace_atom(ProcLabel, Arity) = atom(ProcLabel, Args) :-
-	list__duplicate(Arity, dummy_arg_info, Args).
+	list.duplicate(Arity, dummy_arg_info, Args).
 
 	% add_trace_atom_arg_value(ArgNum, HldsNum, ProgVis, Val, !Atom):
 	% Register the fact that argument number ArgNum in Atom is the HLDS
@@ -1242,7 +1237,7 @@
 		atom(P, Args)) :-
 	term_rep.univ_to_rep(Val, Rep),
 	Arg = arg_info(c_bool_to_merc_bool(ProgVis), HldsNum, yes(Rep)),
-	list__replace_nth_det(Args0, ArgNum, Arg, Args).
+	list.replace_nth_det(Args0, ArgNum, Arg, Args).
 
 	% Like add_trace_atom_arg_value, except that the specified variable
 	% has no value (i.e. it is not bound).
@@ -1253,7 +1248,7 @@
 add_trace_atom_arg_no_value(atom(P, Args0), ArgNum, HldsNum, ProgVis)
 		= atom(P, Args) :-
 	Arg = arg_info(c_bool_to_merc_bool(ProgVis), HldsNum, no),
-	list__replace_nth_det(Args0, ArgNum, Arg, Args).
+	list.replace_nth_det(Args0, ArgNum, Arg, Args).
 
 	% This code converts a C bool (represented as int) to a Mercury bool.
 :- func c_bool_to_merc_bool(int) = bool.
@@ -1291,16 +1286,15 @@
 :- type trace_node_key
 	--->	key(int).
 
-:- pred search_trace_node_map(trace_node_map, trace_node_key,
-		trace_node(trace_node_key)).
-:- mode search_trace_node_map(in, in, out) is semidet.
+:- pred search_trace_node_map(trace_node_map::in, trace_node_key::in,
+		trace_node(trace_node_key)::out) is semidet.
 
 search_trace_node_map(map(Map), Key, Node) :-
-	map__search(Map, Key, Node).
+	map.search(Map, Key, Node).
 
-load_trace_node_map(Stream, Map, Key) -->
-	io__read(Stream, ResKey),
-	{
+load_trace_node_map(Stream, Map, Key, !IO) :-
+	io.read(Stream, ResKey, !IO),
+	(
 		ResKey = ok(Key)
 	;
 		ResKey = eof,
@@ -1308,9 +1302,9 @@
 	;
 		ResKey = error(Msg, _),
 		throw(io_error("load_trace_node_map", Msg))
-	},
-	io__read(Stream, ResMap),
-	{
+	),
+	io.read(Stream, ResMap, !IO),
+	(
 		ResMap = ok(Map)
 	;
 		ResMap = eof,
@@ -1318,23 +1312,22 @@
 	;
 		ResMap = error(Msg, _),
 		throw(io_error("load_trace_node_map", Msg))
-	}.
+	).
 
 :- pragma export(save_trace_node_store(in, in, in, di, uo),
 		"MR_DD_save_trace").
 
-save_trace_node_store(Stream, Store, NodeId) -->
-	{ map__init(Map0) },
-	{ node_id_to_key(NodeId, Key) },
-	{ node_map(Store, NodeId, map(Map0), Map) },
-	io__write(Stream, Key),
-	io__write_string(Stream, ".\n"),
-	io__write(Stream, Map),
-	io__write_string(Stream, ".\n").
-
-:- pred node_map(trace_node_store, trace_node_id, trace_node_map,
-		trace_node_map).
-:- mode node_map(in, in, in, out) is det.
+save_trace_node_store(Stream, Store, NodeId, !IO) :-
+	map.init(Map0),
+	node_id_to_key(NodeId, Key),
+	node_map(Store, NodeId, map(Map0), Map),
+	io.write(Stream, Key, !IO),
+	io.write_string(Stream, ".\n", !IO),
+	io.write(Stream, Map, !IO),
+	io.write_string(Stream, ".\n", !IO).
+
+:- pred node_map(trace_node_store::in, trace_node_id::in, trace_node_map::in,
+		trace_node_map::out) is det.
 
 node_map(Store, NodeId, map(Map0), Map) :-
 	(
@@ -1342,32 +1335,31 @@
 	->
 		node_id_to_key(NodeId, Key),
 		convert_node(Node1, Node2),
-		map__det_insert(Map0, Key, Node2, Map1),
+		map.det_insert(Map0, Key, Node2, Map1),
 		Next = preceding_node(Node1),
 		node_map(Store, Next, map(Map1), Map)
 	;
 		Map = map(Map0)
 	).
 
-:- pred node_id_to_key(trace_node_id, trace_node_key).
-:- mode node_id_to_key(in, out) is det.
+:- pred node_id_to_key(trace_node_id::in, trace_node_key::out) is det.
 
 :- pragma foreign_proc("C", node_id_to_key(Id::in, Key::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
 "Key = (MR_Integer) Id;").
 
 node_id_to_key(_, _) :-
-	private_builtin__sorry("node_id_to_key").
+	private_builtin.sorry("node_id_to_key").
 
-:- pred convert_node(trace_node(trace_node_id), trace_node(trace_node_key)).
-:- mode convert_node(in, out) is det.
+:- pred convert_node(trace_node(trace_node_id)::in, 
+	trace_node(trace_node_key)::out) is det.
 
 :- pragma foreign_proc("C", convert_node(N1::in, N2::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
 "N2 = N1;").
 
 convert_node(_, _) :-
-	private_builtin__sorry("convert_node").
+	private_builtin.sorry("convert_node").
 
 	% Given a node in an annotated trace, return a reference to
 	% the preceding node in the trace, or a NULL reference if
@@ -1398,7 +1390,7 @@
 		Args = Args0
 	;
 		Which = only_user_headvars,
-		Args = list__filter(is_user_visible_arg, Args0)
+		Args = list.filter(is_user_visible_arg, Args0)
 	).
 
 chosen_head_vars_presentation = only_user_headvars.
@@ -1418,7 +1410,7 @@
 		Which = all_headvars
 	),
 	maybe_filter_headvars(Which, Args0, Args),
-	list__index1_det(Args, N, Arg).
+	list.index1_det(Args, N, Arg).
 
 absolute_arg_num(any_head_var(ArgNum), _, ArgNum).
 absolute_arg_num(user_head_var(N), atom(_, Args), ArgNum) :-
Index: browser/declarative_oracle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.36
diff -u -r1.36 declarative_oracle.m
--- browser/declarative_oracle.m	24 Jan 2005 07:41:03 -0000	1.36
+++ browser/declarative_oracle.m	24 Jan 2005 08:22:02 -0000
@@ -47,7 +47,7 @@
 
 	% Produce a new oracle state.
 	%
-:- pred oracle_state_init(io__input_stream::in, io__output_stream::in, 
+:- pred oracle_state_init(io.input_stream::in, io.output_stream::in, 
 	browser_info.browser_persistent_state::in, oracle_state::out) is det.
 
 	% Add a module to the set of modules trusted by the oracle
@@ -88,8 +88,7 @@
 	% contents can be updated after user responses.
 	%
 :- pred query_oracle(decl_question(T)::in, oracle_response(T)::out,
-	oracle_state::in, oracle_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	oracle_state::in, oracle_state::out, io::di, io::uo) is cc_multi.
 
 	% Confirm that the node found is indeed an e_bug or an i_bug.  If
 	% the bug is overruled, force the oracle to forget everything
@@ -97,7 +96,7 @@
 	%
 :- pred oracle_confirm_bug(decl_bug::in, decl_evidence(T)::in,
 	decl_confirmation::out, oracle_state::in, oracle_state::out,
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
 	% Revise a question in the oracle's knowledge base so that the oracle
 	% will get an answer to the question from the user.
@@ -119,9 +118,9 @@
 
 :- implementation.
 
-:- import_module mdb__declarative_user.
-:- import_module mdb__util.
-:- import_module mdbcomp__prim_data.
+:- import_module mdb.declarative_user.
+:- import_module mdb.util.
+:- import_module mdbcomp.prim_data.
 
 :- import_module map, bool, std_util, set, int, bimap, counter, assoc_list,
 	exception, list.
@@ -152,8 +151,7 @@
 	).
 
 :- pred query_oracle_user(user_question(T)::in, oracle_response(T)::out,
-	oracle_state::in, oracle_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	oracle_state::in, oracle_state::out, io::di, io::uo) is cc_multi.
 
 query_oracle_user(UserQuestion, OracleResponse, !Oracle, !IO) :-
 	User0 = !.Oracle ^ user_state,
@@ -198,7 +196,7 @@
 	(
 		Confirmation = overrule_bug
 	->
-		list__foldl(revise_oracle, Evidence, Oracle1, Oracle)
+		list.foldl(revise_oracle, Evidence, Oracle1, Oracle)
 	;
 		Oracle = Oracle1
 	).
Index: browser/declarative_test.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_test.m,v
retrieving revision 1.5
diff -u -r1.5 declarative_test.m
--- browser/declarative_test.m	24 Jan 2005 07:41:03 -0000	1.5
+++ browser/declarative_test.m	24 Jan 2005 09:33:34 -0000
@@ -25,48 +25,45 @@
 
 :- import_module list, std_util, map, require.
 
-main -->
-	process_arguments(MaybeFile),
+main(!IO) :-
+	process_arguments(MaybeFile, !IO),
 	(
-		{ MaybeFile = yes(File) }
+		MaybeFile = yes(File)
 	->
-		load_trace_node_map(File, Map, Key),
-		io__stdin_stream(StdIn),
-		io__stdout_stream(StdOut),
-		{ diagnoser_state_init(StdIn, StdOut, State) },
-		diagnosis(Map, Key, Response, State, _),
-		io__write_string("Diagnoser response:\n"),
-		io__write(Response),
-		io__nl
+		load_trace_node_map(File, Map, Key, !IO),
+		io.stdin_stream(StdIn, !IO),
+		io.stdout_stream(StdOut, !IO),
+		diagnoser_state_init(StdIn, StdOut, State),
+		diagnosis(Map, Key, Response, State, _, !IO),
+		io.write_string("Diagnoser response:\n", !IO),
+		io.write(Response, !IO),
+		io.nl(!IO)
 	;
-		usage
+		usage(!IO)
 	).
 
-:- pred process_arguments(maybe(io__input_stream),
-		io__state, io__state).
-:- mode process_arguments(out, di, uo) is det.
+:- pred process_arguments(maybe(io.input_stream)::out, io::di, io::uo) is det.
 
-process_arguments(MaybeFile) -->
-	io__command_line_arguments(Args),
+process_arguments(MaybeFile, !IO) :-
+	io.command_line_arguments(Args, !IO),
 	(
-		{ Args = [FileName] }
+		Args = [FileName]
 	->
-		io__open_input(FileName, Res),
+		io.open_input(FileName, Res, !IO),
 		(
-			{ Res = ok(File) }
+			Res = ok(File)
 		->
-			{ MaybeFile = yes(File) }
+			MaybeFile = yes(File)
 		;
-			{ MaybeFile = no }
+			MaybeFile = no
 		)
 	;
-		{ MaybeFile = no }
+		MaybeFile = no
 	).
 
-:- pred usage(io__state, io__state).
-:- mode usage(di, uo) is det.
+:- pred usage(io::di, io::uo) is det.
 
-usage -->
-	io__progname_base("declarative_test", Name),
-	io__write_strings(["Usage: ", Name, " <filename>\n"]).
+usage(!IO) :-
+	io.progname_base("declarative_test", Name, !IO),
+	io.write_strings(["Usage: ", Name, " <filename>\n"], !IO).
 
Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.17
diff -u -r1.17 declarative_tree.m
--- browser/declarative_tree.m	24 Jan 2005 07:41:03 -0000	1.17
+++ browser/declarative_tree.m	24 Jan 2005 10:03:00 -0000
@@ -34,9 +34,8 @@
 	%
 :- type wrap(S) ---> wrap(S).
 
-:- pred edt_subtree_details(S, edt_node(R), event_number, sequence_number, R) 
-	<= annotated_trace(S, R).
-:- mode edt_subtree_details(in, in, out, out, out) is det.
+:- pred edt_subtree_details(S::in, edt_node(R)::in, event_number::out,
+	sequence_number::out, R::out) is det <= annotated_trace(S, R).
 
 :- pred trace_atom_subterm_is_ground(trace_atom::in, arg_pos::in, 
 	term_path::in) is semidet.
@@ -97,7 +96,7 @@
 	( InitIoSeq = ExitIoSeq ->
 		[]
 	;
-		[map__lookup(IoActionMap, InitIoSeq) |
+		[map.lookup(IoActionMap, InitIoSeq) |
 			make_io_actions(IoActionMap, InitIoSeq + 1, ExitIoSeq)]
 	).
 
@@ -385,8 +384,7 @@
 	ProcId = proc("std_util", predicate, "std_util", "builtin_aggregate", 
 		4, _).
 
-:- pred not_at_depth_limit(S, R) <= annotated_trace(S, R).
-:- mode not_at_depth_limit(in, in) is semidet.
+:- pred not_at_depth_limit(S::in, R::in) is semidet <= annotated_trace(S, R).
 
 not_at_depth_limit(Store, Ref) :-
 	call_node_from_id(Store, Ref, CallNode),
@@ -535,9 +533,8 @@
 	Next = step_left_in_contour(Store, Node),
 	contour_children(ContourType, Store, Next, StartId, Ns1, Ns).
 
-:- pred stratum_children(S, R, R, list(edt_node(R)), list(edt_node(R)))
-		<= annotated_trace(S, R).
-:- mode stratum_children(in, in, in, in, out) is det.
+:- pred stratum_children(S::in, R::in, R::in, list(edt_node(R))::in, 
+	list(edt_node(R))::out) is det <= annotated_trace(S, R).
 
 stratum_children(Store, NodeId, StartId, Ns0, Ns) :-
 	(
@@ -548,9 +545,8 @@
 		stratum_children_2(Store, NodeId, StartId, Ns0, Ns)
 	).
 
-:- pred stratum_children_2(S, R, R, list(edt_node(R)), list(edt_node(R)))
-	<= annotated_trace(S, R).
-:- mode stratum_children_2(in, in, in, in, out) is det.
+:- pred stratum_children_2(S::in, R::in, R::in, list(edt_node(R))::in, 
+	list(edt_node(R))::out) is det <= annotated_trace(S, R).
 
 stratum_children_2(Store, NodeId, StartId, Ns0, Ns) :-
 	det_trace_node_from_id(Store, NodeId, Node),
@@ -713,7 +709,7 @@
 		materialize_contour(Store, NodeId, Node, [], Contour0),
 		(
 			StartLoc = parent_goal(CallId, CallNode),
-			Contour = list__append(Contour0, [CallId - CallNode])
+			Contour = list.append(Contour0, [CallId - CallNode])
 		;
 			StartLoc = cur_goal,
 			Contour = Contour0
@@ -1063,12 +1059,12 @@
 		Goal = conj_rep(Conjs),
 		add_paths_to_conjuncts(Conjs, Path, 1, ConjPaths),
 		MaybePrims = make_primitive_list(Store, 
-			list__append(ConjPaths, GoalPaths),
+			list.append(ConjPaths, GoalPaths),
 			Contour, MaybeEnd, ArgNum, TotalArgs, HeadVars, 
 			AllTraced, Primitives0)
 	;
 		Goal = some_rep(InnerGoal, MaybeCut),
-		InnerPath = list__append(Path, [exist(MaybeCut)]),
+		InnerPath = list.append(Path, [exist(MaybeCut)]),
 		InnerAndPath = goal_and_path(InnerGoal, InnerPath),
 		MaybePrims = make_primitive_list(Store, 
 			[InnerAndPath | GoalPaths],
@@ -1103,10 +1099,10 @@
 				ContourHeadNode = later_disj(_, DisjPathStr, _)
 			),
 			path_from_string_det(DisjPathStr, DisjPath),
-			list__append(Path, PathTail, DisjPath),
+			list.append(Path, PathTail, DisjPath),
 			PathTail = [disj(N)]
 		->
-			list__index1_det(Disjs, N, Disj),
+			list.index1_det(Disjs, N, Disj),
 			DisjAndPath = goal_and_path(Disj, DisjPath),
 			MaybePrims = make_primitive_list(Store, [DisjAndPath |
 				GoalPaths], ContourTail, MaybeEnd, ArgNum,
@@ -1121,10 +1117,10 @@
 			Contour = [_ - ContourHeadNode | ContourTail],
 			ContourHeadNode = switch(_, ArmPathStr),
 			path_from_string_det(ArmPathStr, ArmPath),
-			list__append(Path, PathTail, ArmPath),
+			list.append(Path, PathTail, ArmPath),
 			PathTail = [switch(N)]
 		->
-			list__index1_det(Arms, N, Arm),
+			list.index1_det(Arms, N, Arm),
 			ArmAndPath = goal_and_path(Arm, ArmPath),
 			MaybePrims = make_primitive_list(Store, [ArmAndPath |
 				GoalPaths], ContourTail, MaybeEnd, ArgNum,
@@ -1139,10 +1135,10 @@
 			Contour = [_ - ContourHeadNode | ContourTail],
 			ContourHeadNode = cond(_, CondPathStr, _),
 			path_from_string_det(CondPathStr, CondPath),
-			list__append(Path, PathTail, CondPath),
+			list.append(Path, PathTail, CondPath),
 			PathTail = [ite_cond]
 		->
-			ThenPath = list__append(Path, [ite_then]),
+			ThenPath = list.append(Path, [ite_then]),
 			CondAndPath = goal_and_path(Cond, CondPath),
 			ThenAndPath = goal_and_path(Then, ThenPath),
 			MaybePrims = make_primitive_list(Store, [CondAndPath,
@@ -1155,10 +1151,10 @@
 			cond_node_from_id(Store, ElseCondId, CondNode),
 			CondNode = cond(_, CondPathStr, _),
 			path_from_string_det(CondPathStr, CondPath),
-			list__append(Path, PathTail, CondPath),
+			list.append(Path, PathTail, CondPath),
 			PathTail = [ite_cond]
 		->
-			ElsePath = list__append(Path, [ite_else]),
+			ElsePath = list.append(Path, [ite_else]),
 			ElseAndPath = goal_and_path(Else, ElsePath),
 			MaybePrims = make_primitive_list(Store, [ElseAndPath |
 				GoalPaths], ContourTail, MaybeEnd, ArgNum,
@@ -1183,7 +1179,7 @@
 		->
 			% The end of the primitive list is somewhere inside
 			% NegGoal.
-			NegPath = list__append(Path, [neg]),
+			NegPath = list.append(Path, [neg]),
 			NegAndPath = goal_and_path(NegGoal, NegPath),
 			MaybePrims = make_primitive_list(Store, [NegAndPath], 
 				ContourTail, MaybeEnd, ArgNum, TotalArgs,
@@ -1428,13 +1424,13 @@
 		MaybeNodeId),
 	(
 		AtomicGoal = unify_construct_rep(_CellVar, _Cons, FieldVars),
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			(
 				TermPath0 = [],
 				Origin = primitive_op(File, Line)
 			;
 				TermPath0 = [TermPathStep0 | TermPath],
-				list__index1_det(FieldVars, TermPathStep0,
+				list.index1_det(FieldVars, TermPathStep0,
 					Var),
 				traverse_primitives(Prims, Var, TermPath,
 					Store, ProcRep, Origin)
@@ -1445,8 +1441,8 @@
 		)
 	;
 		AtomicGoal = unify_deconstruct_rep(CellVar, _Cons, FieldVars),
-		( list__member(Var0, BoundVars) ->
-			( list__nth_member_search(FieldVars, Var0, Pos) ->
+		( list.member(Var0, BoundVars) ->
+			( list.nth_member_search(FieldVars, Var0, Pos) ->
 				traverse_primitives(Prims,
 					CellVar, [Pos | TermPath0],
 					Store, ProcRep, Origin)
@@ -1461,7 +1457,7 @@
 	;
 		AtomicGoal = unify_assign_rep(ToVar, FromVar),
 		% We handle assigns the same as we handle unsafe casts.
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			decl_require(unify(Var0, ToVar),
 				"traverse_primitives", "bad assign"),
 			traverse_primitives(Prims, FromVar, TermPath0,
@@ -1473,7 +1469,7 @@
 	;
 		AtomicGoal = unsafe_cast_rep(ToVar, FromVar),
 		% We handle unsafe casts the same as we handle assigns.
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			decl_require(unify(Var0, ToVar),
 				"traverse_primitives", "bad unsafe_cast"),
 			traverse_primitives(Prims, FromVar, TermPath0,
@@ -1484,7 +1480,7 @@
 		)
 	;
 		AtomicGoal = pragma_foreign_code_rep(_Args),
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			Origin = primitive_op(File, Line)
 		;
 			traverse_primitives(Prims, Var0, TermPath0,
@@ -1492,7 +1488,7 @@
 		)
 	;
 		AtomicGoal = unify_simple_test_rep(_LVar, _RVar),
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			throw(internal_error("traverse_primitives", "bad test"))
 		;
 			traverse_primitives(Prims, Var0, TermPath0,
@@ -1512,7 +1508,7 @@
 			Prims, Var0, TermPath0, Store, ProcRep, Origin)
 	;
 		AtomicGoal = builtin_call_rep(_, _, _),
-		( list__member(Var0, BoundVars) ->
+		( list.member(Var0, BoundVars) ->
 			Origin = primitive_op(File, Line)
 		;
 			traverse_primitives(Prims, Var0, TermPath0,
@@ -1535,7 +1531,7 @@
 
 traverse_call(BoundVars, File, Line, Args, MaybeNodeId,
 		Prims, Var, TermPath, Store, ProcRep, Origin) :-
-	( list__member(Var, BoundVars) ->
+	( list.member(Var, BoundVars) ->
 		Pos = find_arg_pos(Args, Var),
 		(
 			MaybeNodeId = yes(NodeId),
@@ -1557,7 +1553,7 @@
 add_paths_to_conjuncts([], _, _, []).
 add_paths_to_conjuncts([Goal | Goals], ParentPath, N,
 		[goal_and_path(Goal, Path) | GoalAndPaths]) :-
-	list__append(ParentPath, [conj(N)], Path),
+	list.append(ParentPath, [conj(N)], Path),
 	add_paths_to_conjuncts(Goals, ParentPath, N + 1, GoalAndPaths).
 
 %-----------------------------------------------------------------------------%
@@ -1670,8 +1666,8 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred decl_require(pred, string, string).
-:- mode decl_require((pred) is semidet, in, in) is det.
+:- pred decl_require((pred)::in((pred) is semidet), string::in, string::in) 
+	is det.
 
 decl_require(Goal, Loc, Msg) :-
 	(
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.39
diff -u -r1.39 declarative_user.m
--- browser/declarative_user.m	24 Jan 2005 07:41:04 -0000	1.39
+++ browser/declarative_user.m	24 Jan 2005 10:07:09 -0000
@@ -34,7 +34,7 @@
 
 :- type user_state.
 
-:- pred user_state_init(io__input_stream::in, io__output_stream::in, 
+:- pred user_state_init(io.input_stream::in, io.output_stream::in, 
 	browser_info.browser_persistent_state::in, user_state::out) is det.
 
 	% This predicate handles the interactive part of the declarative
@@ -43,14 +43,12 @@
 	% truth of it in the intended interpretation.
 	%
 :- pred query_user(user_question(T)::in, user_response(T)::out,
-	user_state::in, user_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	user_state::in, user_state::out, io::di, io::uo) is cc_multi.
 
 	% Confirm that the node found is indeed an e_bug or an i_bug.
 	%
 :- pred user_confirm_bug(decl_bug::in, decl_confirmation::out,
-	user_state::in, user_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	user_state::in, user_state::out, io::di, io::uo) is cc_multi.
 
 	% Returns the state of the term browser.
 	%
@@ -65,14 +63,14 @@
 
 :- implementation.
 
-:- import_module mdb__browse.
-:- import_module mdb__browser_term.
-:- import_module mdb__io_action.
-:- import_module mdb__util.
-:- import_module mdb__declarative_execution.
-:- import_module mdb__declarative_tree.
-:- import_module mdbcomp__prim_data.
-:- import_module mdbcomp__program_representation.
+:- import_module mdb.browse.
+:- import_module mdb.browser_term.
+:- import_module mdb.io_action.
+:- import_module mdb.util.
+:- import_module mdb.declarative_execution.
+:- import_module mdb.declarative_tree.
+:- import_module mdbcomp.prim_data.
+:- import_module mdbcomp.program_representation.
 :- import_module mdb.parse.
 :- import_module mdb.term_rep.
 
@@ -80,8 +78,8 @@
 
 :- type user_state
 	--->	user(
-			instr	:: io__input_stream,
-			outstr	:: io__output_stream,
+			instr	:: io.input_stream,
+			outstr	:: io.output_stream,
 			browser	:: browser_persistent_state
 		).
 
@@ -98,8 +96,8 @@
 		!IO).
 
 :- pred handle_command(user_command::in, user_question(T)::in,
-	user_response(T)::out, user_state::in, user_state::out, io__state::di,
-	io__state::uo) is cc_multi.
+	user_response(T)::out, user_state::in, user_state::out, 
+	io::di, io::uo) is cc_multi.
 
 handle_command(yes, UserQuestion, Response, !User, !IO) :-
 	Question = get_decl_question(UserQuestion),
@@ -241,7 +239,7 @@
 
 handle_command(illegal_command, UserQuestion, Response, !User, 
 		!IO) :-
-	io__write_string("Unknown command, 'h' for help.\n", !IO),
+	io.write_string("Unknown command, 'h' for help.\n", !IO),
 	query_user(UserQuestion, Response, !User, !IO).
 
 :- func arg_num_to_arg_pos(int) = arg_pos.
@@ -261,8 +259,7 @@
 get_decl_question(plain_question(Q)) = Q.
 get_decl_question(question_with_default(Q, _)) = Q.
 
-:- pred user_question_prompt(user_question(T), string).
-:- mode user_question_prompt(in, out) is det.
+:- pred user_question_prompt(user_question(T)::in, string::out) is det.
 
 user_question_prompt(plain_question(Question), Prompt) :-
 	decl_question_prompt(Question, Prompt).
@@ -270,17 +267,15 @@
 user_question_prompt(question_with_default(Question, DefaultTruth), Prompt) :-
 	decl_question_prompt(Question, QuestionPrompt),
 	default_prompt(DefaultTruth, DefaultPrompt),
-	string__append(QuestionPrompt, DefaultPrompt, Prompt).
+	string.append(QuestionPrompt, DefaultPrompt, Prompt).
 
-:- pred decl_question_prompt(decl_question(T), string).
-:- mode decl_question_prompt(in, out) is det.
+:- pred decl_question_prompt(decl_question(T)::in, string::out) is det.
 
 decl_question_prompt(wrong_answer(_, _, _), "Valid? ").
 decl_question_prompt(missing_answer(_, _, _), "Complete? ").
 decl_question_prompt(unexpected_exception(_, _, _), "Expected? ").
 
-:- pred default_prompt(decl_truth, string).
-:- mode default_prompt(in, out) is det.
+:- pred default_prompt(decl_truth::in, string::out) is det.
 
 default_prompt(correct, "[yes] ").
 default_prompt(erroneous, "[no] ").
@@ -329,43 +324,42 @@
 
 :- pred browse_chosen_io_action(list(io_action)::in, int::in,
 	maybe(term_path)::out, user_state::in, user_state::out,
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
-browse_chosen_io_action(IoActions, ActionNum, MaybeMark, User0, User) -->
-	( { list__index1(IoActions, ActionNum, IoAction) } ->
-		browse_io_action(IoAction, MaybeMark, User0, User)
-	;
-		io__write_string("No such IO action.\n"),
-		{ MaybeMark = no },
-		{ User = User0 }
+browse_chosen_io_action(IoActions, ActionNum, MaybeMark, User0, User, !IO) :-
+	( list.index1(IoActions, ActionNum, IoAction) ->
+		browse_io_action(IoAction, MaybeMark, User0, User, !IO)
+	;
+		io.write_string("No such IO action.\n", !IO),
+		MaybeMark = no,
+		User = User0
 	).
 
 :- pred print_chosen_io_actions(list(io_action)::in, int::in, int::in,
-	user_state::in, io__state::di, io__state::uo) is cc_multi.
+	user_state::in, io::di, io::uo) is cc_multi.
 
-print_chosen_io_actions(Atom, From, To, User0) -->
-	print_chosen_io_action(Atom, From, User0, OK),
-	( { OK = yes, From + 1 =< To } ->
-		print_chosen_io_actions(Atom, From + 1, To, User0)
+print_chosen_io_actions(Atom, From, To, User0, !IO) :-
+	print_chosen_io_action(Atom, From, User0, OK, !IO),
+	( OK = yes, From + 1 =< To ->
+		print_chosen_io_actions(Atom, From + 1, To, User0, !IO)
 	;
-		[]
+		true
 	).
 
 :- pred print_chosen_io_action(list(io_action)::in, int::in, user_state::in,
-	bool::out, io__state::di, io__state::uo) is cc_multi.
+	bool::out, io::di, io::uo) is cc_multi.
 
-print_chosen_io_action(IoActions, ActionNum, User0, OK) -->
-	( { list__index1(IoActions, ActionNum, IoAction) } ->
-		print_io_action(User0, IoAction),
-		{ OK = yes }
+print_chosen_io_action(IoActions, ActionNum, User0, OK, !IO) :-
+	( list.index1(IoActions, ActionNum, IoAction) ->
+		print_io_action(User0, IoAction, !IO),
+		OK = yes
 	;
-		io__write_string("No such IO action.\n"),
-		{ OK = no }
+		io.write_string("No such IO action.\n", !IO),
+		OK = no
 	).
 
 :- pred browse_io_action(io_action::in, maybe(term_path)::out,
-	user_state::in, user_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	user_state::in, user_state::out, io::di, io::uo) is cc_multi.
 
 browse_io_action(IoAction, MaybeMark, !User, !IO) :-
 	Term = io_action_to_browser_term(IoAction),
@@ -374,9 +368,8 @@
 	maybe_convert_dirs_to_path(MaybeDirs, MaybeMark),
 	!:User = !.User ^ browser := Browser.
 
-:- pred browse_decl_bug(decl_bug::in, maybe(int)::in,
-	user_state::in, user_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+:- pred browse_decl_bug(decl_bug::in, maybe(int)::in, user_state::in,
+	user_state::out, io::di, io::uo) is cc_multi.
 
 browse_decl_bug(Bug, MaybeArgNum, !User, !IO) :-
 	decl_bug_trace_atom(Bug, InitAtom, FinalAtom),
@@ -391,13 +384,13 @@
 
 :- pred browse_atom_argument(trace_atom::in, trace_atom::in, int::in, 
 	maybe(term_path)::out, user_state::in, user_state::out, 
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
 browse_atom_argument(InitAtom, FinalAtom, ArgNum, MaybeMark, !User, !IO) :-
 	FinalAtom = atom(_, Args0),
 	maybe_filter_headvars(chosen_head_vars_presentation, Args0, Args),
 	(
-		list__index1(Args, ArgNum, ArgInfo),
+		list.index1(Args, ArgNum, ArgInfo),
 		ArgInfo = arg_info(_, _, MaybeArg),
 		MaybeArg = yes(ArgRep),
 		term_rep.rep_to_univ(ArgRep, Arg)
@@ -410,14 +403,13 @@
 		maybe_convert_dirs_to_path(MaybeDirs, MaybeMark),
 		!:User = !.User ^ browser := Browser
 	;
-		io__write_string(!.User ^ outstr, "Invalid argument number\n",
+		io.write_string(!.User ^ outstr, "Invalid argument number\n",
 			!IO),
 		MaybeMark = no
 	).
 
 :- pred browse_atom(trace_atom::in, trace_atom::in, maybe(term_path)::out,
-	user_state::in, user_state::out, io__state::di, io__state::uo)
-	is cc_multi.
+	user_state::in, user_state::out, io::di, io::uo) is cc_multi.
 
 browse_atom(InitAtom, FinalAtom, MaybeMark, !User, !IO) :-
 	FinalAtom = atom(ProcLayout, Args),
@@ -492,7 +484,7 @@
 	).
 
 :- pred print_atom_arguments(trace_atom::in, int::in, int::in, user_state::in,
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
 print_atom_arguments(Atom, From, To, User, !IO) :-
 	print_atom_argument(Atom, From, User, OK, !IO),
@@ -506,13 +498,13 @@
 	).
 
 :- pred print_atom_argument(trace_atom::in, int::in, user_state::in, bool::out,
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
 print_atom_argument(Atom, ArgNum, User, OK, !IO) :-
 	Atom = atom(_, Args0),
 	maybe_filter_headvars(chosen_head_vars_presentation, Args0, Args),
 	(
-		list__index1(Args, ArgNum, ArgInfo),
+		list.index1(Args, ArgNum, ArgInfo),
 		ArgInfo = arg_info(_, _, MaybeArg),
 		MaybeArg = yes(ArgRep),
 		term_rep.rep_to_univ(ArgRep, Arg)
@@ -521,13 +513,13 @@
 			decl_caller_type, User ^ browser, !IO),
 		OK = yes
 	;
-		io__write_string(User ^ outstr, "Invalid argument number\n",
+		io.write_string(User ^ outstr, "Invalid argument number\n",
 			!IO),
 		OK = no
 	).
 
-:- pred maybe_convert_dirs_to_path(maybe(list(dir)), maybe(term_path)).
-:- mode maybe_convert_dirs_to_path(in, out) is det.
+:- pred maybe_convert_dirs_to_path(maybe(list(dir))::in, 
+	maybe(term_path)::out) is det.
 
 maybe_convert_dirs_to_path(no, no).
 maybe_convert_dirs_to_path(yes(Dirs), yes(TermPath)) :-
@@ -535,8 +527,7 @@
 
 	% Reverse the first argument and append the second to it.
 	%
-:- pred reverse_and_append(list(T), list(T), list(T)).
-:- mode reverse_and_append(in, in, out) is det.
+:- pred reverse_and_append(list(T)::in, list(T)::in, list(T)::out) is det.
 
 reverse_and_append([], Bs, Bs).
 reverse_and_append([A | As], Bs, Cs) :-
@@ -571,11 +562,10 @@
 	;	empty_command		% User just pressed return.
 	;	illegal_command.	% None of the above.
 
-:- pred user_help_message(user_state, io__state, io__state).
-:- mode user_help_message(in, di, uo) is det.
+:- pred user_help_message(user_state::in, io::di, io::uo) is det.
 
-user_help_message(User) -->
-	io__write_strings(User ^ outstr, [
+user_help_message(User, !IO) :-
+	io.write_strings(User ^ outstr, [
 		"According to the intended interpretation of the program,",
 		" answer one of:\n",
 		"\ty\tyes\t\tthe node is correct\n",
@@ -601,13 +591,12 @@
 		"\ta\tabort\t\t",
 			"abort this diagnosis session and return to mdb\n",
 		"\th, ?\thelp\t\tthis help message\n"
-	]).
+	], !IO).
 
-:- pred user_confirm_bug_help(user_state, io__state, io__state).
-:- mode user_confirm_bug_help(in, di, uo) is det.
+:- pred user_confirm_bug_help(user_state::in, io::di, io::uo) is det.
 
-user_confirm_bug_help(User) -->
-	io__write_strings(User ^ outstr, [
+user_confirm_bug_help(User, !IO) :-
+	io.write_strings(User ^ outstr, [
 		"Answer one of:\n",
 		"\ty\tyes\t\tconfirm that the suspect is a bug\n",
 		"\tn\tno\t\tdo not accept that the suspect is a bug\n",
@@ -615,18 +604,17 @@
 		"\ta\tabort\t\t",
 			"abort this diagnosis session and return to mdb\n",
 		"\th, ?\thelp\t\tthis help message\n"
-	]).
+	], !IO).
+
+:- pred get_command(string::in, user_command::out, 
+	user_state::in, user_state::out, io::di, io::uo) is det.
 
-:- pred get_command(string, user_command, user_state, user_state,
-		io__state, io__state).
-:- mode get_command(in, out, in, out, di, uo) is det.
-
-get_command(Prompt, Command, User, User) -->
-	util__trace_getline(Prompt, Result, User ^ instr, User ^ outstr),
-	(
-		{ Result = ok(String) },
-		{ Words = string__words(char__is_whitespace, String) },
-		{
+get_command(Prompt, Command, User, User, !IO) :-
+	util.trace_getline(Prompt, Result, User ^ instr, User ^ outstr, !IO),
+	(
+		Result = ok(String),
+		Words = string.words(char.is_whitespace, String),
+		(
 			Words = [CmdWord | CmdArgs],
 			(
 				cmd_handler(CmdWord, CmdHandler),
@@ -639,20 +627,21 @@
 		;
 			Words = [],
 			Command = empty_command
-		}
+		)
 	;
-		{ Result = error(Error) },
-		{ io__error_message(Error, Msg) },
-		io__write_string(User ^ outstr, Msg),
-		io__nl(User ^ outstr),
-		{ Command = abort }
+		Result = error(Error),
+		io.error_message(Error, Msg),
+		io.write_string(User ^ outstr, Msg, !IO),
+		io.nl(User ^ outstr, !IO),
+		Command = abort
 	;
-		{ Result = eof },
-		{ Command = abort }
+		Result = eof,
+		Command = abort
 	).
 
-:- pred cmd_handler(string, func(list(string)) = user_command).
-:- mode cmd_handler(in, out((func(in) = out is semidet))) is semidet.
+:- pred cmd_handler(string::in, 
+	(func(list(string)) = user_command)::out(func(in) = out is semidet))
+	is semidet.
 
 cmd_handler("y",	one_word_cmd(yes)).
 cmd_handler("yes",	one_word_cmd(yes)).
@@ -684,10 +673,10 @@
 :- func browse_arg_cmd(list(string)::in) = (user_command::out) is semidet.
 
 browse_arg_cmd([Arg]) = browse_arg(yes(ArgNum)) :-
-	string__to_int(Arg, ArgNum).
+	string.to_int(Arg, ArgNum).
 browse_arg_cmd([]) = browse_arg(no).
 browse_arg_cmd(["io", Arg]) = browse_io(ArgNum) :-
-	string__to_int(Arg, ArgNum).
+	string.to_int(Arg, ArgNum).
 
 :- func print_arg_cmd(list(string)::in) = (user_command::out) is semidet.
 
@@ -710,13 +699,13 @@
 trust_arg_cmd(["module"]) = trust_module.
 
 string_to_range(Arg, From, To) :-
-	( string__to_int(Arg, Num) ->
+	( string.to_int(Arg, Num) ->
 		From = Num,
 		To = Num
 	;
-		[FirstStr, SecondStr] = string__words(is_dash, Arg),
-		string__to_int(FirstStr, First),
-		string__to_int(SecondStr, Second),
+		[FirstStr, SecondStr] = string.words(is_dash, Arg),
+		string.to_int(FirstStr, First),
+		string.to_int(SecondStr, Second),
 		( First =< Second ->
 			From = First,
 			To = Second
@@ -776,92 +765,97 @@
 	% output stream.
 	%
 :- pred write_decl_question(decl_question(T)::in, user_state::in,
-	io__state::di, io__state::uo) is cc_multi.
+	io::di, io::uo) is cc_multi.
 
-write_decl_question(wrong_answer(_, _, Atom), User) -->
-	write_decl_final_atom(User, "", decl_caller_type, Atom).
+write_decl_question(wrong_answer(_, _, Atom), User, !IO) :-
+	write_decl_final_atom(User, "", decl_caller_type, Atom, !IO).
 	
-write_decl_question(missing_answer(_, Call, Solns), User) -->
-	write_decl_init_atom(User, "Call ", decl_caller_type, Call),
+write_decl_question(missing_answer(_, Call, Solns), User, !IO) :-
+	write_decl_init_atom(User, "Call ", decl_caller_type, Call, !IO),
 	(
-		{ Solns = [] }
-	->
-		io__write_string(User ^ outstr, "No solutions.\n")
+		Solns = [],
+		io.write_string(User ^ outstr, "No solutions.\n", !IO)
 	;
-		io__write_string(User ^ outstr, "Solutions:\n"),
-		list__foldl(write_decl_final_atom(User, "\t", print_all), Solns)
+		Solns = [_ | _],
+		io.write_string(User ^ outstr, "Solutions:\n", !IO),
+		list.foldl(write_decl_final_atom(User, "\t", print_all), Solns,
+			!IO)
 	).
 
-write_decl_question(unexpected_exception(_, Call, ExceptionRep), User) -->
-	write_decl_init_atom(User, "Call ", decl_caller_type, Call),
-	io__write_string(User ^ outstr, "Throws "),
-	{ term_rep.rep_to_univ(ExceptionRep, Exception) },
-	io__write(User ^ outstr, include_details_cc, univ_value(Exception)),
-	io__nl(User ^ outstr).
-
-:- pred write_decl_bug(decl_bug::in, user_state::in,
-	io__state::di, io__state::uo) is cc_multi.
-
-write_decl_bug(e_bug(EBug), User) -->
-	(
-		{ EBug = incorrect_contour(_, Atom, Contour, _) },
-		io__write_string(User ^ outstr, "Found incorrect contour:\n"),
-		io__write_list(Contour, "", write_decl_final_atom(User, "", 
-			decl_caller_type)),
-		write_decl_final_atom(User, "", decl_caller_type, Atom)
-	;
-		{ EBug = partially_uncovered_atom(Atom, _) },
-		io__write_string(User ^ outstr,
-				"Found partially uncovered atom:\n"),
-		write_decl_init_atom(User, "", decl_caller_type, Atom)
-	;
-		{ EBug = unhandled_exception(Atom, ExceptionRep, _) },
-		io__write_string(User ^ outstr, "Found unhandled exception:\n"),
-		write_decl_init_atom(User, "", decl_caller_type, Atom),
-		{ term_rep.rep_to_univ(ExceptionRep, Exception) },
-		io__write(User ^ outstr, include_details_cc,
-				univ_value(Exception)),
-		io__nl(User ^ outstr)
-	).
-
-write_decl_bug(i_bug(IBug), User) -->
-	{ IBug = inadmissible_call(Parent, _, Call, _) },
-	io__write_string(User ^ outstr, "Found inadmissible call:\n"),
-	write_decl_atom(User, "Parent ", decl_caller_type, init(Parent)),
-	write_decl_atom(User, "Call ", decl_caller_type, init(Call)).
+write_decl_question(unexpected_exception(_, Call, ExceptionRep), User, !IO) :-
+	write_decl_init_atom(User, "Call ", decl_caller_type, Call, !IO),
+	io.write_string(User ^ outstr, "Throws ", !IO),
+	term_rep.rep_to_univ(ExceptionRep, Exception),
+	io.write(User ^ outstr, include_details_cc, univ_value(Exception), 
+		!IO),
+	io.nl(User ^ outstr, !IO).
+
+:- pred write_decl_bug(decl_bug::in, user_state::in, io::di, io::uo) 
+	is cc_multi.
 
-:- pred write_decl_init_atom(user_state::in, string::in, browse_caller_type::in,
-	init_decl_atom::in, io__state::di, io__state::uo) is cc_multi.
+write_decl_bug(e_bug(EBug), User, !IO) :-
+	(
+		EBug = incorrect_contour(_, Atom, Contour, _),
+		io.write_string(User ^ outstr, "Found incorrect contour:\n",
+			!IO),
+		io.write_list(Contour, "", write_decl_final_atom(User, "", 
+			decl_caller_type), !IO),
+		write_decl_final_atom(User, "", decl_caller_type, Atom, !IO)
+	;
+		EBug = partially_uncovered_atom(Atom, _),
+		io.write_string(User ^ outstr,
+			"Found partially uncovered atom:\n", !IO),
+		write_decl_init_atom(User, "", decl_caller_type, Atom, !IO)
+	;
+		EBug = unhandled_exception(Atom, ExceptionRep, _),
+		io.write_string(User ^ outstr, "Found unhandled exception:\n",
+			!IO),
+		write_decl_init_atom(User, "", decl_caller_type, Atom, !IO),
+		term_rep.rep_to_univ(ExceptionRep, Exception),
+		io.write(User ^ outstr, include_details_cc,
+			univ_value(Exception), !IO),
+		io.nl(User ^ outstr, !IO)
+	).
+
+write_decl_bug(i_bug(IBug), User, !IO) :-
+	IBug = inadmissible_call(Parent, _, Call, _),
+	io.write_string(User ^ outstr, "Found inadmissible call:\n", !IO),
+	write_decl_atom(User, "Parent ", decl_caller_type, init(Parent), !IO),
+	write_decl_atom(User, "Call ", decl_caller_type, init(Call), !IO).
+
+:- pred write_decl_init_atom(user_state::in, string::in, 
+	browse_caller_type::in, init_decl_atom::in, 
+	io::di, io::uo) is cc_multi.
 
-write_decl_init_atom(User, Indent, CallerType, InitAtom) -->
-	write_decl_atom(User, Indent, CallerType, init(InitAtom)).
+write_decl_init_atom(User, Indent, CallerType, InitAtom, !IO) :-
+	write_decl_atom(User, Indent, CallerType, init(InitAtom), !IO).
 
 :- pred write_decl_final_atom(user_state::in, string::in,
-	browse_caller_type::in, final_decl_atom::in, io__state::di,
-	io__state::uo) is cc_multi.
+	browse_caller_type::in, final_decl_atom::in, 
+	io::di, io::uo) is cc_multi.
 
-write_decl_final_atom(User, Indent, CallerType, FinalAtom) -->
-	write_decl_atom(User, Indent, CallerType, final(FinalAtom)).
+write_decl_final_atom(User, Indent, CallerType, FinalAtom, !IO) :-
+	write_decl_atom(User, Indent, CallerType, final(FinalAtom), !IO).
 
 :- pred write_decl_atom(user_state::in, string::in, browse_caller_type::in,
-	some_decl_atom::in, io__state::di, io__state::uo) is cc_multi.
+	some_decl_atom::in, io::di, io::uo) is cc_multi.
 
 write_decl_atom(User, Indent, CallerType, DeclAtom, !IO) :-
-	io__write_string(User ^ outstr, Indent, !IO),
+	io.write_string(User ^ outstr, Indent, !IO),
 	unravel_decl_atom(DeclAtom, TraceAtom, IoActions),
 	TraceAtom = atom(ProcLabel, Args0),
 	ProcId = get_proc_id_from_layout(ProcLabel),
 	get_pred_attributes(ProcId, _, Functor, _, PredOrFunc),
 	Which = chosen_head_vars_presentation,
 	maybe_filter_headvars(Which, Args0, Args1),
-	list__map(trace_atom_arg_to_univ, Args1, Args),
+	list.map(trace_atom_arg_to_univ, Args1, Args),
 		%
 		% Call the term browser to print the atom (or part of it
 		% up to a size limit) as a goal.
 		%
 	BrowserTerm = synthetic_term_to_browser_term(Functor, Args,
 		is_function(PredOrFunc)),
-	browse__print_browser_term(BrowserTerm, User ^ outstr, CallerType,
+	browse.print_browser_term(BrowserTerm, User ^ outstr, CallerType,
 		User ^ browser, !IO),
 	write_io_actions(User, IoActions, !IO).
 
@@ -877,36 +871,37 @@
 		Univ = univ('_' `with_type` unbound)
 	).
 
-:- pred write_io_actions(user_state::in, list(io_action)::in, io__state::di,
-	io__state::uo) is cc_multi.
+:- pred write_io_actions(user_state::in, list(io_action)::in, 
+	io::di, io::uo) is cc_multi.
 
-write_io_actions(User, IoActions) -->
-	{ list__length(IoActions, NumIoActions) },
-	( { NumIoActions = 0 } ->
-		[]
+write_io_actions(User, IoActions, !IO) :-
+	list.length(IoActions, NumIoActions),
+	( NumIoActions = 0 ->
+		true
 	;
-		( { NumIoActions = 1 } ->
-			io__write_string(User ^ outstr, "1 io action:")
+		( NumIoActions = 1 ->
+			io.write_string(User ^ outstr, "1 io action:", !IO)
 		;
-			io__write_int(User ^ outstr, NumIoActions),
-			io__write_string(User ^ outstr, " io actions:")
+			io.write_int(User ^ outstr, NumIoActions, !IO),
+			io.write_string(User ^ outstr, " io actions:", !IO)
 		),
- 		{ NumPrinted = get_num_printed_io_actions(User ^ browser) },
- 		( { NumIoActions =< NumPrinted } ->
-			io__nl(User ^ outstr),
-			list__foldl(print_io_action(User), IoActions)
+ 		NumPrinted = get_num_printed_io_actions(User ^ browser),
+ 		( NumIoActions =< NumPrinted ->
+			io.nl(User ^ outstr, !IO),
+			list.foldl(print_io_action(User), IoActions, !IO)
 		;
-			io__write_string(User ^ outstr, " too many to show"),
-			io__nl(User ^ outstr)
+			io.write_string(User ^ outstr, " too many to show",
+				!IO),
+			io.nl(User ^ outstr, !IO)
 		)
 	).
 
-:- pred print_io_action(user_state::in, io_action::in,
-	io__state::di, io__state::uo) is cc_multi.
+:- pred print_io_action(user_state::in, io_action::in, io::di, io::uo) 
+	is cc_multi.
 
 print_io_action(User, IoAction, !IO) :-
 	Term = io_action_to_browser_term(IoAction),
-	browse__print_browser_term(Term, User ^ outstr, print_all,
+	browse.print_browser_term(Term, User ^ outstr, print_all,
 		User ^ browser, !IO).
 
 %-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
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