[m-dev.] Typeclass problem

Ralph Becket rafe at cs.mu.OZ.AU
Wed Apr 5 12:24:22 AEST 2006


I want to define a type class like this:

	:- typeclass clausal(C, L) <= ((C -> L), literal(L)) where [

	    func clauses(C::ia) = (list(clause(L))::oa) is det

	].

but for

	:- instance clausal(clause(L), L)  <= literal(L).

the compiler is complaining that

clauses.m:053: Error: types in instance declarations must be functors
with distinct variables as arguments: clausal(clause(_1), _1).

Why is this restriction necessary when the second argument is a
function of the first?

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