[m-rev.] trivial diff: documentation improvements
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu May 29 19:15:04 AEST 2003
compiler/type_util.m:
compiler/det_analysis.m:
Improve the documentation of predicates checking for user-defined
equality.
Zoltan.
cvs diff: Diffing .
Index: det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.160
diff -u -b -r1.160 det_analysis.m
--- det_analysis.m 15 Mar 2003 03:08:44 -0000 1.160
+++ det_analysis.m 29 May 2003 09:12:07 -0000
@@ -995,17 +995,20 @@
Msgs = Msgs0
).
-% return true iff there was a `where equality is <predname>' declaration
-% for the specified type.
+% Return true iff the principal type constructor of the given type
+% has user-defined equality.
+
:- pred det_type_has_user_defined_equality_pred(det_info::in,
(type)::in) is semidet.
det_type_has_user_defined_equality_pred(DetInfo, Type) :-
det_info_get_module_info(DetInfo, ModuleInfo),
type_has_user_defined_equality_pred(ModuleInfo, Type, _).
-% return yes iff the results of the specified unification might depend on
+% Return yes iff the results of the specified unification might depend on
% the concrete representation of the abstract values involved.
+
:- pred det_infer_unify_examines_rep(unification::in, bool::out) is det.
+
det_infer_unify_examines_rep(assign(_, _), no).
det_infer_unify_examines_rep(construct(_, _, _, _, _, _, _), no).
det_infer_unify_examines_rep(deconstruct(_, _, _, _, _, _), yes).
@@ -1015,7 +1018,6 @@
% examine the representation...
% but we will catch those by reporting errors in the
% compiler-generated code for the complicated unification.
-
% Deconstruction unifications cannot fail if the type
% only has one constructor, or if the variable is known to be
Index: type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.117
diff -u -b -r1.117 type_util.m
--- type_util.m 26 May 2003 09:00:11 -0000 1.117
+++ type_util.m 29 May 2003 09:11:39 -0000
@@ -62,11 +62,18 @@
:- pred type_ctor_is_tuple(type_ctor).
:- mode type_ctor_is_tuple(in) is semidet.
- % return true iff there was a `where equality is <predname>'
- % declaration for the specified type, and return the name of
- % the equality predicate and the context of the type declaration.
-:- pred type_has_user_defined_equality_pred(module_info,
- (type), unify_compare).
+ % Succeed iff there was either a `where equality is <predname>' or a
+ % `where comparison is <predname>' declaration for the principal type
+ % constructor of the specified type, and return the ids of the declared
+ % unify and/or comparison predicates. Note that even if the type
+ % constructor has only a `where comparison is' clause, it effectively
+ % has user-defined equality, two values being equal only if the
+ % compare pred returns equal.
+ %
+ % If the type is a type variable and thus has no principal type
+ % constructor, fail.
+:- pred type_has_user_defined_equality_pred(module_info, (type),
+ unify_compare).
:- mode type_has_user_defined_equality_pred(in, in, out) is semidet.
:- pred type_body_has_user_defined_equality_pred(module_info::in,
cvs diff: Diffing notes
--------------------------------------------------------------------------
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