[m-rev.] for review: refine the mode declaration of solutions

Erwan Jahier Erwan.Jahier at irisa.fr
Wed Aug 22 22:15:04 AEST 2001


Fergus 
wrote:

| On 20-Aug-2001, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
| > 
| > Ok thanks, but how do you say to the compiler that when calling via 
| > solutions/2 a multidet predicate, you necessarily obtain a not empty list?
| 
| Change
| :- mode solutions(pred(out) is multi, out) is det.
| 
| to
| :- mode solutions(pred(out) is multi, out(non_empty_list)) is det.
| 
| in std_util.m.
| 
| Likewise for the function version.

aha, yop, thanks. 

--------------------------------------------------------------------
Estimated hours taken: .1
branches: main.

library/std_util.m
	Specify in the mode declarations of solutions* that when they
	take a multidet closure as argument, they output a non empty
	list.


Index: std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.235
diff -u -d -u -r1.235 std_util.m
--- std_util.m  2001/07/03 08:16:25     1.235
+++ std_util.m  2001/08/22 12:06:41
@@ -137,23 +137,24 @@
 % is required.
 
 :- pred solutions(pred(T), list(T)).
-:- mode solutions(pred(out) is multi, out) is det.
+:- mode solutions(pred(out) is multi, out(non_empty_list)) is det.
 :- mode solutions(pred(out) is nondet, out) is det.
 
 :- func solutions(pred(T)) = list(T).
-:- mode solutions(pred(out) is multi) = out is det.
+:- mode solutions(pred(out) is multi) = out(non_empty_list) is det.
 :- mode solutions(pred(out) is nondet) = out is det.
 
 :- pred solutions_set(pred(T), set(T)).
-:- mode solutions_set(pred(out) is multi, out) is det.
+:- mode solutions_set(pred(out) is multi, out(non_empty_list)) is det.
 :- mode solutions_set(pred(out) is nondet, out) is det.
 
 :- func solutions_set(pred(T)) = set(T).
-:- mode solutions_set(pred(out) is multi) = out is det.
+:- mode solutions_set(pred(out) is multi) = out(non_empty_list) is det.
 :- mode solutions_set(pred(out) is nondet) = out is det.
 
 :- pred unsorted_solutions(pred(T), list(T)).
-:- mode unsorted_solutions(pred(out) is multi, out) is cc_multi.
+:- mode unsorted_solutions(pred(out) is multi, out(non_empty_list)) 
+        is cc_multi.
 :- mode unsorted_solutions(pred(out) is nondet, out) is cc_multi.
 
 :- func aggregate(pred(T), func(T, U) = U, U) = U.

-- 
R1.


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