[m-rev.] diff: remove duplicate code from check_typeclass

Julien Fischer juliensf at students.cs.mu.OZ.AU
Thu Feb 5 21:21:00 AEDT 2004


Estimated hours taken: 0.1
Branches: main

Remove code that duplicates functionality that is now part of the
standard library.

compiler/check_typeclass.m:
	Use list.map_foldl2 from the standard library.
	Delete the the predicate check_typeclass.list_map_foldl2.

Julien.

Index: check_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.53
diff -u -r1.53 check_typeclass.m
--- check_typeclass.m	30 Jan 2004 06:00:44 -0000	1.53
+++ check_typeclass.m	4 Feb 2004 14:03:35 -0000
@@ -87,7 +87,7 @@
 	module_info_classes(!.ModuleInfo, ClassTable),
 	module_info_instances(!.ModuleInfo, InstanceTable0),
 	map__to_assoc_list(InstanceTable0, InstanceList0),
-	list_map_foldl2(check_one_class(ClassTable), InstanceList0,
+	list__map_foldl2(check_one_class(ClassTable), InstanceList0,
 		InstanceList, check_tc_info([], !.ModuleInfo, !.QualInfo),
 		check_tc_info(Errors, !:ModuleInfo, !:QualInfo), !IO),
 	(
@@ -115,22 +115,6 @@
 			qual_info :: qual_info
 		).

-	% list__map_foldl2(Pred, InList, OutList, StartA, EndA, StartB, EndB)
-	% calls Pred with two accumulator (with the initial values of
-	% StartA and StartB respectively) on each element of InList
-	% (working left-to-right) to transform InList into OutList.
-	% The final values of the accumulators are returned in EndA
-	% and EndB respectively.
-:- pred list_map_foldl2(pred(X, Y, Z, Z, W, W), list(X), list(Y), Z, Z, W, W).
-:- mode list_map_foldl2(pred(in, out, in, out, di, uo) is det,
-			     in, out, in, out, di, uo) is det.
-
-list_map_foldl2(_, [],  [], A, A) -->
-        [].
-list_map_foldl2(P, [H0|T0], [H|T], A0, A) -->
-        call(P, H0, H, A0, A1),
-        list_map_foldl2(P, T0, T, A1, A).
-
 	% check all the instances of one class.
 :- pred check_one_class(class_table,
 	pair(class_id, list(hlds_instance_defn)),
@@ -170,7 +154,7 @@
 				ClassProc = hlds_class_proc(PredId, _)
 			),
 			PredIds),
-		list_map_foldl2(
+		list__map_foldl2(
 			check_class_instance(ClassId, SuperClasses,
 				ClassVars, ClassInterface, Interface,
 				ClassVarSet, PredIds),

--------------------------------------------------------------------------
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