[mercury-users] constructor class syntax

Michael Day mikeday at corplink.com.au
Wed Nov 3 17:37:00 AEDT 1999


> > :- class ordered_container(C(T)) <= container(C), ordered(T) where
> > 	[
> > 		func lowest_element(C(T)) = T,
> > 		func highest_element(C(T)) = T,
> > 		...
> > 		and so forth
> > 	].

> How would it differ from say
> 
> 	:- typeclass ordered_container(C) <= container(C) where
> 		[
> 			func lowest_element(C(T)) = T <= ordered(T),
> 			func highest_element(C(T)) = T <= ordered(T),
> 			...
> 			and so forth
> 		].

Hmm you've got me there. What would it mean if lowest_element had the
ordered typeclass constraint, and highest_element didn't? Would it be
possible for C(T) to be an instance of ordered_container, if T was not
ordered? Is one ordered constraint on one method enough, or do you have to
specify them on all methods for it to "work"? Or do constraints on T for a
subset of methods have a valid meaning I'm just not seeing?

<departs to think before opening mouth again>

and thanks for the references, hopefully they will lift the clouds that so
oppress my vision.

Michael

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list