mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-28 07:44:43 +00:00
Estimated hours taken: 12
Branches: main
Remove from std_util.m the predicates that merely call predicates in
the type_desc, construct and deconstruct modules, to reduce clutter
in std_util.m.
library/std_util.m:
Remove those predicates from std_util.m.
library/deconstruct.m:
Add a type we need that was previously defined in std_util.m.
library/construct.m:
Delete some module qualifications that have now become unnecessary,
browser/browse.m:
browser/browser_info.m:
browser/declarative_tree.m:
browser/dl.m:
browser/help.m:
browser/sized_pretty.m:
browser/term_rep.m:
compiler/bytecode_gen.m:
compiler/llds_out.m:
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
library/assoc_list.m:
library/hash_table.m:
library/io.m:
library/pprint.m:
library/private_builtin.m:
library/prolog.m:
library/require.m:
library/rtti_implementation.m:
library/store.m:
library/term.m:
library/term_to_xml.m:
library/version_hash_table.m:
mdbcomp/program_representation.m:
Import type_desc.m, construct.m and/or deconstruct.m to provide
definitions of functions or predicates that up till now were in
std_util.m. Modify the calls if the called function or predicate
had a slightly different interface in std_util.m.
Also, convert term_to_xml.m to four-space indentation, and delete
unnecessary module qualifications in term.m.
tests/debugger/polymorphic_output.{m,inp,exp,exp2}:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
tests/hard_coded/elim_special_pred.m:
tests/hard_coded/existential_bound_tvar.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/higher_order_type_manip.m:
tests/hard_coded/nullary_ho_func.m:
tests/hard_coded/tuple_test.m:
tests/hard_coded/type_ctor_desc.m:
tests/hard_coded/type_qual.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested2.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/parent2.child.m:
tests/hard_coded/typeclasses/existential_rtti.m:
tests/recompilation/type_qual_re.m.1:
cvs update: Updating tests/submodules
cvs update: Updating tests/tabling
cvs update: Updating tests/term
cvs update: Updating tests/tools
cvs update: Updating tests/trailing
cvs update: Updating tests/typeclasses
cvs update: Updating tests/valid
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
tests/valid/agc_unused_in.m:
Replace references to the deleted predicates in std_util with
references to the equivalent predicates in type_desc, construct
and/or deconstruct. In test cases that already tested both the
functionality in std_util and in the other modules, simply delete
the part exercising std_util.
98 lines
2.3 KiB
Mathematica
98 lines
2.3 KiB
Mathematica
% "Hello World" in Mercury, using nested modules.
|
|
|
|
:- module nested3.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- module nested3.child.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- type foo ---> bar ; baz(int).
|
|
|
|
:- pred hello(io__state::di, io__state::uo) is det.
|
|
|
|
:- end_module nested3.child.
|
|
|
|
:- implementation.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module nested3.child2.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- type foo ---> bar ; baz(int).
|
|
|
|
:- pred hello(io__state::di, io__state::uo) is det.
|
|
:- end_module nested3.child2.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module nested3.child.
|
|
:- implementation.
|
|
|
|
hello --> io__write_string("nested3.child.hello\n").
|
|
|
|
:- end_module nested3.child.
|
|
|
|
:- module nested3.child2.
|
|
:- implementation.
|
|
|
|
hello --> io__write_string("nested3.child2.hello\n").
|
|
|
|
:- end_module nested3.child2.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% now we're back in the parent module.
|
|
|
|
:- import_module nested3.child.
|
|
:- use_module nested3.child2.
|
|
:- import_module require.
|
|
:- import_module std_util.
|
|
:- import_module type_desc.
|
|
|
|
:- type t1 == nested3.child.foo.
|
|
:- type t2 == child.foo.
|
|
:- type t3 == foo.
|
|
:- type t4 == nested3.child2.foo.
|
|
:- type t5 == child2.foo.
|
|
|
|
main -->
|
|
nested3.child.hello,
|
|
child.hello,
|
|
hello,
|
|
nested3.child2.hello,
|
|
child2.hello,
|
|
|
|
print("t1 = "), print(type_of(has_type_t1)), nl,
|
|
print("t2 = "), print(type_of(has_type_t2)), nl,
|
|
print("t3 = "), print(type_of(has_type_t3)), nl,
|
|
print("t4 = "), print(type_of(has_type_t4)), nl,
|
|
print("t5 = "), print(type_of(has_type_t5)), nl,
|
|
|
|
print("has_type_t1 = "), print(has_type_t1), nl,
|
|
print("has_type_t2 = "), print(has_type_t2), nl,
|
|
print("has_type_t3 = "), print(has_type_t3), nl,
|
|
print("has_type_t4 = "), print(has_type_t4), nl,
|
|
print("has_type_t5 = "), print(has_type_t5), nl,
|
|
|
|
{ true }.
|
|
|
|
:- func has_type_t1 = t1.
|
|
:- func has_type_t2 = t2.
|
|
:- func has_type_t3 = t3.
|
|
:- func has_type_t4 = t4.
|
|
:- func has_type_t5 = t5.
|
|
|
|
has_type_t1 = nested3.child.bar.
|
|
has_type_t2 = child.bar.
|
|
has_type_t3 = bar.
|
|
has_type_t4 = nested3.child2.bar.
|
|
has_type_t5 = child2.bar.
|
|
|
|
:- end_module nested3.
|