[m-rev.] for review: allow arbitrary types in class constraints

Ralph Becket rafe at cs.mu.OZ.AU
Tue May 7 11:28:56 AEST 2002


David Jeffery, Monday,  6 May 2002:
> 
> I think you'll find problems with constraints like this on
> predicate signatures.
> 
> Try something of the form:
> 
> :- pred p(T, T) <= c(list(T)).
> :- mode p(in, in) is semidet.
> 
> and in the body 'p', do something which requires the
> type-info for 'T' to be extracted from the constraint. e.g.
> 
> p(X, Y) :-
>     ...,
>     X = Y. % This unification requires the type-info for T

Would there be significant overhead in passing the typeinfo for T as
well as the typeclassinfo for list(T)?

It seems to me that

:- pred p(T, T) <= (c(list(T))).

is expanded by the compiler to something like

:- pred p(T, T) <= (typeinfo(T), c(list(T))).

Wouldn't that solve the problem?

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