[mercury-users] Extending a structure data type in Mercury

Ralph Becket rafe at cs.mu.OZ.AU
Sun Jun 5 14:23:26 AEST 2005


Gregory D. Weber, Saturday,  4 June 2005:
> I want to "extend" a structure type by adding fields, like this:
> 
> :- type prule ---> prule(key, class, ftable, conds).
> :- type cn2rule == prule.
> :- type icnrule ---> icnrule(key, class, ftable, conds, info).
> 
> But want icnrule to be considered a subtype of prule,
> also as a subtype of cn2rule, so that procedures developed for prules 
> and cn2rules will also work for icnrules.
> 
> I've found a solution, but I'm wondering if there's a better way.

Hmm.  I think you might find it easiest to do this sort of thing using
type classes.  Would that work?

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