[mercury-users] constructor class syntax

Michael Day mikeday at corplink.com.au
Wed Nov 3 17:51:54 AEDT 1999


> :- class mappable(F) where
> [
> 	pred map(pred(A, B), F(A), F(B)),
> 	mode map(in, in, out) is det
> ].
> 
> :- instance mappable(list) where
> [
> 	pred(map/3) is list__map
> ].

Yes that is what I mean, for some reason I thought there would be
confusion about the arity of the "list" mentioned in the instance
declaration. But of course the type class mappable requires a type
constructor of arity 1, which does not need to be restated explicitly.

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