[m-dev.] Module qualification of typeclass methods

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 1 22:26:45 AEDT 2001

On 01-Nov-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> However regarding the semantics.  I would like an operator which would allow
> one to include one module and get some set of its sub-modules automatically.
> I don't believe Ferguss suggestion allows that

Well, it does give you _some_ help.

Suppose the module that you wish to include is called `foo',
and it has submodules `bar1', `bar2', and `bar3'.
If it is written in the simplest way, as

	:- module foo.
	:- interface.
	:- include_module bar1, bar2, bar3.
	:- end_module foo.

then you're out of luck.
However, if it is written like this,

	:- module foo.
	:- interface.
	:- include_module bar1, bar2, bar3.

	   :- module submodules.
	   :- interface.
	   :- include foo__bar1, foo__bar2, foo__bar3.
	   :- end_module.

	:- end_module foo.

then you can import `foo' and all of its submodules using

	:- import_module foo.
	:- import_module foo__submodules.

Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
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