[m-users.] IO and global state.
Zoltan Somogyi
zoltan.somogyi at runbox.com
Mon Apr 26 23:02:14 AEST 2021
On Mon, 26 Apr 2021 07:51:57 +0100, "Sean Charles (emacstheviking)" <objitsu at gmail.com> wrote:
> :- func debug_on(felt_options) = bool.
> :- func debug_on(io::di, io::uo) = bool. % LINE 28, see error message below.
...
> options.m:028: Error: some but not all arguments have modes.
> options.m:028: The argument without a mode is the return value.
> ** Error making `Mercury/int3s/options.int3'.
> make: *** [felt] Error 1
>
>
> Help! I am confused because it looks identical to the declaration on the previous line except it uses IO not the option_table...
You need to pay more attention to the error messages.
The second declaration differs from the first NOT just in using IO
instead of the option table. It also differs by specifying modes for
the I/O state arguments, which the first declaration did not do
for the felt_options argument. The error message specifically told you
that this was the problem.
Mercury requires that if you specify a mode for *some* arguments
of a predicate or function, then you must specify a mode for *all* of them.
Zoltan.
More information about the users
mailing list