[mercury-users] constructor class syntax

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Nov 4 12:16:06 AEDT 1999


On 03-Nov-1999, Michael Day <mikeday at corplink.com.au> wrote:
> 
> > > Ahh now that seems much more obvious. Would all the methods still need the
> > > constraint that T be ordered though?
> > 
> > No, they wouldn't... that is a typo.
> 
> Okay cool, guess my only remaining question is whether the compiler is
> smart enough to see F as a type class parameter and potentially
> conflicting usages in the definition (F(T) and F(T, U) perhaps?) and
> give in gracefully :)

Getting that analysis right is (reasonably) simple. It is a matter of assigning
type/type constructor a ``kind'', which is essentially the arity of the
constructor. Propagating the information through is simple: every type in a
pred declaration must of of kind 0. The error in the definition using F(T) and
F(T, U) would get caught because the first occurence of F has kind 1 but the
second has kind 2.

HTH.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
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