[mercury-users] Question about parameterise the types.

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 31 20:26:40 AEDT 2001

On 31-Jan-2001, Raymee Chau <rwmc at cs.adfa.edu.au> wrote:
> Does anyone know if it is possible for me to use higher order programming
> to parameterise the types in the higher levels of the module structure?
> For example I would like to use type T for the arguments of higher level
> predicates, so that the type for the arguments of lower level predicates
> can be say list(int), list(bool) or something else.  Can this be done?
> How?

For that kind of abstraction, type classes are probably the right
thing to use.  I suggest that you check out the "Type classes" chapter
of the Mercury language reference manual, if you haven't already done
so, and then ask again here when (as will no doubt soon be the case ;-)
you have a more specific question.

Note that the Mercury tutorial doesn't have anything on type classes,
unfortunately... any volunteers? ;-)

Probably some of the books, papers and/or tutorials on Haskell
have a good introduction to type classes.  Mercury's type classes
are quite similar to type classes in Haskell, so it may help to
ask about type class tutorials on the Haskell mailing list.


Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
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