[m-dev.] for review: bintree.m -- opening type declaration

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Wed Feb 15 16:29:58 AEDT 2006


Dear all,

I have modified bintree.m to open the type declaration.  Purpose: this allows users to extend the functionality of the protocol without being required to duplicate library internal implementation code.  Also, as the type may have purposes not expected by the library designer, the open type allows the user to use this type without resorting to hacking around the protocol.

$ diff -u merc-0.12.1/bintree.sav merc-0.12.1/bintree.m
--- bintree.sav 2006-02-15 00:30:28.000000000 -0500
+++ bintree.m   2006-02-15 00:31:11.000000000 -0500
@@ -30,7 +30,14 @@
 :- interface.
 :- import_module list, assoc_list.
 
-:- type bintree(K, V).
+:- type bintree(K, V)
+       --->    empty
+       ;       tree(
+                       K,
+                       V,
+                       bintree(K, V),
+                       bintree(K, V)
+               ).
 
 :- pred bintree__init(bintree(K, V)::uo) is det.
 
@@ -123,15 +130,6 @@
 
 :- import_module require, int, string, std_util.
 
-:- type bintree(K, V)
-       --->    empty
-       ;       tree(
-                       K,
-                       V,
-                       bintree(K, V),
-                       bintree(K, V)
-               ).
-
 %-----------------------------------------------------------------------------%
 
 bintree__init(empty).
----- end diff -u

Sincerely,
Douglas M. Auclair

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list