[m-dev.] Foreign type compare and unification

Mark Brown dougl at cs.mu.OZ.AU
Thu May 23 14:09:17 AEST 2002


On 22-May-2002, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> On Tue, May 21, 2002 at 04:10:22PM +1000, Mark Brown wrote:
> > 	:- generic_instance printable(T) where [
> > 		(to_doc(X) = pprint__to_doc(X))
> > 	].
> > 
> > This would _not_ imply that all types are members of the typeclass.
> 
> So every type that wants to be printable would need an instance
> declaration?

Yes.

> And every type that wants to allow term comparison?

Yes.

> Or functor and arg?

Yes.

It would make sense to have a "standard" typeclass that most types are
in, which would cover at least these three cases.  This should be considered
when designing the typeclass hierarchy.

> In-in mode Unification?

No.  In-in mode unification is fundamental in Mercury, due to
implicit modes.

(In the current implementation, test unifications and comparisons are
available for all types.  The former because they are fundamental, the
latter because they are merely "very important" -- we need to be able
to implement the type map/2 in a generic way.  This pragmatic decision
was made long before typeclasses were implemented.)

Cheers,
Mark.

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