-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathhello.m
49 lines (37 loc) · 1.43 KB
/
hello.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%-----------------------------------------------------------------------------%
%
% Example module for use with dynamic linking.
% The driver program dl_test.m dynamically loads the object code
% for this module and then calls the procedures defined here,
% e.g. hello/2.
%
% This source file is hereby placed in the public domain. -fjh (the author).
%
%-----------------------------------------------------------------------------%
:- module hello.
:- interface.
:- import_module float.
:- import_module int.
:- import_module io.
%-----------------------------------------------------------------------------%
% A very basic test: print "Hello world".
%
:- pred hello(io::di, io::uo) is det.
% Test passing floating point arguments.
%
:- func add3(float, float, float) = float.
% Test passing integer arguments.
%
:- func add3int(int, int, int) = int.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
:- implementation.
hello(!IO) :-
io.print("Hello, world\n", !IO).
add3(X, Y, Z) = X + Y + Z.
add3int(X, Y, Z) = X + Y + Z.
%-----------------------------------------------------------------------------%
:- end_module hello.
%-----------------------------------------------------------------------------%