for review: add nested modules [5/5]
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Mar 2 01:34:40 AEDT 1998
On 28-Feb-1998, Andrew Bromage <bromage at cs.mu.OZ.AU> wrote:
> G'day.
>
> Fergus Henderson wrote:
>
> > cvs diff: tests/hard_coded/parent.child.m is a new entry, no comparison available
> > cvs diff: tests/hard_coded/parent.exp is a new entry, no comparison available
> > cvs diff: tests/hard_coded/parent.m is a new entry, no comparison available
> > cvs diff: tests/hard_coded/parent2.child.m is a new entry, no comparison available
> > cvs diff: tests/hard_coded/parent2.exp is a new entry, no comparison available
> > cvs diff: tests/hard_coded/parent2.m is a new entry, no comparison available
>
> Could we see these please?
Sure.
Index: parent.child.m
===================================================================
RCS file: parent.child.m
diff -N parent.child.m
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent.child.m Thu Feb 26 00:08:04 1998
@@ -0,0 +1,13 @@
+% "Hello World" in Mercury, using nested modules.
+
+:- module parent:child.
+:- interface.
+:- import_module io.
+
+:- type foo ---> bar ; baz(int).
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello --> io__write_string("Hello, world\n").
Index: parent.exp
===================================================================
RCS file: parent.exp
diff -N parent.exp
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent.exp Wed Feb 25 23:55:31 1998
@@ -0,0 +1,2 @@
+Hello, world
+Hello, world
Index: parent.m
===================================================================
RCS file: parent.m
diff -N parent.m
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent.m Thu Feb 26 00:08:04 1998
@@ -0,0 +1,18 @@
+% "Hello World" in Mercury, using nested modules.
+
+:- module parent.
+:- interface.
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- include_module child.
+:- import_module parent:child.
+
+main -->
+ parent:child:hello,
+ % child:hello, % not yet supported
+ hello.
+
Index: parent2.child.m
===================================================================
RCS file: parent2.child.m
diff -N parent2.child.m
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent2.child.m Thu Feb 26 00:08:04 1998
@@ -0,0 +1,15 @@
+% "Hello World" in Mercury,
+% using nested modules.
+
+:- module parent2:child.
+:- interface.
+
+% module `io' is imported in parent2
+
+:- type foo ---> bar ; baz(int).
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+main --> hello, parent2:hello.
Index: parent2.exp
===================================================================
RCS file: parent2.exp
diff -N parent2.exp
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent2.exp Thu Feb 26 00:00:46 1998
@@ -0,0 +1,2 @@
+Hello world
+Hello world
Index: parent2.m
===================================================================
RCS file: parent2.m
diff -N parent2.m
--- /dev/null Mon Mar 2 01:27:22 1998
+++ parent2.m Thu Feb 26 00:08:04 1998
@@ -0,0 +1,14 @@
+% "Hello World" in Mercury,
+% using nested modules.
+
+:- module parent2.
+:- interface.
+:- import_module io.
+
+:- include_module child.
+
+:- implementation.
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+hello --> print("Hello world\n").
cvs diff: Diffing typeclasses
--
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.
More information about the developers
mailing list