[m-dev.] io streams

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Dec 23 13:51:42 AEDT 1999


On 23-Dec-1999, Robert Ernst Johann JESCHOFNIK <rejj at cat.cs.mu.OZ.AU> wrote:
> On Thu, 23 Dec 1999, Michael Day wrote:
> > :- typeclass stream__stream(S) where
> > 	[
> > 		pred stream__get_name(string, S, S),
> > 		mode stream__get_name(out, di, uo) is det
> > 	].
> 
> I'm curious - if these methods are module qualified like this, does this
> mean that I cannot make my own type in a different module, and then make
> it an instance?

No.  You can write something like e.g.

	:- module foo.
	:- type bar.
	:- instance stream__stream(bar) where [
		pred(stream__get_name/3) is foo__get_bar_name
	].
	:- pred get_bar_name(string, bar, bar).

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