Files
mercury/compiler/prog_io_util.m
Simon Taylor 46a8da81cb Implement builtin tuple types, similar to those in Haskell.
Estimated hours taken: 30

Implement builtin tuple types, similar to those in Haskell.

Tuples are constructed and deconstructed using
the syntax X = {Arg1, Arg2, ...}.
Tuples have type `{Arg1, Arg2, ...}'.

Unary tuples (X = {Arg}) do work, unlike in Haskell. The rationale
for this is that it is useful to be able to construct unary tuples
to be passed to a polymorphic predicate which uses std_util__deconstruct
to deal with a tuple of any arity. Since this is probably the only
use for unary tuples, it's not really worth the effort of treating
them as no_tag types, so we don't.

The type-infos for tuples have the same structure as for higher-order
types. There is a single type_ctor_info for tuples, and the arity
is placed before the argument type_infos.

library/parser.m:
	Change the way '{}/N' terms are parsed, so that the parsed
	representation is consistent with the way other functors
	are represented (previously the arguments were left as
	unparsed ','/2 terms). This avoids special case code
	in prog_io__parse_qualified_term, term__term_to_type
	and term__type_to_term.

compiler/prog_io_dcg.m:
compiler/prog_io_util.m:
	Handle the new structure of '{}/N' terms when parsing DCG escapes
	by converting the argument list back into a single ','/2 term.

compiler/module_qual.m:
	Treat tuples as a builtin type.

compiler/typecheck.m:
	Typecheck tuple constructors.

compiler/mode_util.m:
	Propagate types into tuple bound insts.

compiler/type_util.m:
	Add type_is_tuple/2 and type_id_is_tuple/1 to identify tuple types.
	Add tuples to the list of types which are not atomic types.

	Handle tuple types in `type_constructors' and
	`get_cons_id_arg_types' and `switch_type_num_functors'.

compiler/tabling.m:
	Handle tabling of tuples.

compiler/term_util.m:
	Handle tuples in the code to compute functor norms.

compiler/magic_util.m:
compiler/rl.m:
compiler/rl_key.m:
	Handle tuple types in the Aditi back end.

compiler/mercury_to_mercury.m:
library/io.m:
library/term_io.m:
	Handle output of '{}/N' terms.

compiler/higher_order.m:
compiler/simplify.m:
	Don't specialize complicated unifications of tuple
	types into calls to a specific unification procedure --
	even if the procedure were implemented, it probably
	wouldn't be that much more efficient.

compiler/unify_proc.m:
	Generate unification procedures for complicated unifications
	of tuples (other than in-in unifications). These are generated
	lazily as required.

compiler/make_hlds.m:
	Export add_special_pred for use by unify_proc.m.

compiler/polymorphism.m:
	Export polymorphism__process_pred for use by unify_proc.m.

compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/ml_code_util.m:
	Handle unify procedure names and tags for tuple types.

compiler/mlds_to_c.m:
	Output tuple types as MR_Tuple.

compiler/ml_unify_gen.m:
	Compute the field types for tuples.

compiler/polymorphism.m:
compiler/pseudo_type_info.m:
	Treat tuple type_infos in a similar way to higher-order type_infos.

compiler/hlds_data.m:
	Document how cons_ids for tuple types are represented.

compiler/switch_gen.m:
compiler/table_gen.m:
	Add tuple types to switches on type_util__builtin_type.

compiler/llds_out.m:
util/mdemangle.c:
profiler/demangle.m:
	Transform items named "{}" to "f_tuple" when mangling symbols.

library/builtin.m:
	Define the type_ctor_info used for tuples.

library/private_builtin.m:
	Add `builtin_unify_tuple/2' and `builtin_compare_tuple/3',
	both of which abort. All comparisons and in-in unifications
	of tuples are performed by the generic unification functions
	in runtime/mercury_ho_call.c and runtime/mercury.c.

library/std_util.m:
	Implement the various RTTI functions for tuples.

	Encode tuple `TypeCtorDesc's in a similar way to that
	used for higher-order types. This has the consequence that the limit
	on the arity of higher-order types is now MAX_VIRTUAL_REG,
	rather than 2*MAX_VIRTUAL_REG.

	Avoid calling MR_GC_free for the type-info vector returned
	from ML_expand() for tuples because unlike the vectors
	for du types, it is not copied.

runtime/mercury_type_info.h:
	Add macros for extracting fields from tuple type-infos.
	These just call the macros for extracting fields from higher-order
	type-infos.

	Add a macro MR_type_ctor_rep_is_variable_arity(), which
	returns TRUE for tuples and higher-order types.

	The distinction between higher-order and first-order types
	is now misnamed -- the distinction is really between fixed arity
	types and builtin variable arity types. I'm not sure whether
	it's worth renaming everything.

runtime/mercury.h:
runtime/mercury.c:
	Define unification and comparison of tuples in
	high-level code grades.

runtime/mercury_deep_copy_body.h:
runtime/mercury_make_type_info_body.h:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
	Handle tuple types in code which traverses data using RTTI.

tests/hard_coded/construct.{m,exp}:
tests/hard_coded/expand.{m,exp}:
	Test RTTI functions from std_util.m applied to tuples.

tests/hard_coded/tuple_test.{m,exp}:
	Test unification, comparison, term_to_type etc. applied to tuples.

tests/hard_coded/deep_copy.{m,exp}:
	Test deep copy of tuples.

tests/hard_coded/typeclasses/tuple_instance.{m,exp}:
	Test instance declarations for tuples.

tests/tabling/expand_tuple.{m,exp}:
	Test tabling of tuples.

tests/hard_coded/write.m:
	Add some module qualifications for code which uses
	`{}/1' constructors which are not tuples.

tests/invalid/errors2.{m,err_exp,err_exp2}:
	Test handling of tuples in type errors messages.

NEWS:
doc/reference_manual.texi:
w3/news/newsdb.inc:
	Document tuples.

doc/transition_guide.texi:
	Document the change to the parsing of '{}/N' terms.
2000-09-18 11:53:19 +00:00

515 lines
16 KiB
Mathematica

%-----------------------------------------------------------------------------%
% Copyright (C) 1996-2000 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
%
% File: prog_io_util.m.
% Main author: fjh.
%
% This module defines the types used by prog_io and its subcontractors
% to return the results of parsing, and some utility predicates needed
% by several of prog_io's submodules.
%
% Most parsing predicates must check for errors. They return either the
% item(s) they were looking for, or an error indication.
%
% Most of the parsing predicates return a `maybe1(T)'
% or a `maybe2(T1, T2)', which will either be the
% `ok(ParseTree)' (or `ok(ParseTree1, ParseTree2)'),
% if the parse is successful, or `error(Message, Term)'
% if it is not. The `Term' there should be the term which
% is syntactically incorrect.
:- module prog_io_util.
:- interface.
:- import_module prog_data, (inst).
:- import_module list, map, std_util, term, io.
:- type maybe2(T1, T2) ---> error(string, term)
; ok(T1, T2).
:- type maybe1(T) == maybe1(T, generic).
:- type maybe1(T, U) ---> error(string, term(U))
; ok(T).
:- type maybe_functor == maybe_functor(generic).
:- type maybe_functor(T) == maybe2(sym_name, list(term(T))).
% ok(SymName, Args - MaybeFuncRetArg) ; error(Msg, Term).
:- type maybe_pred_or_func(T) == maybe2(sym_name, pair(list(T), maybe(T))).
:- type maybe_item_and_context
== maybe2(item, prog_context).
:- type var2tvar == map(var, tvar).
:- type var2pvar == map(var, prog_var).
:- pred add_context(maybe1(item), prog_context, maybe_item_and_context).
:- mode add_context(in, in, out) is det.
%
% Various predicates to parse small bits of syntax.
% These predicates simply fail if they encounter a syntax error.
%
:- pred parse_list_of_vars(term(T), list(var(T))).
:- mode parse_list_of_vars(in, out) is semidet.
:- pred parse_name_and_arity(module_name, term(_T), sym_name, arity).
:- mode parse_name_and_arity(in, in, out, out) is semidet.
:- pred parse_name_and_arity(term(_T), sym_name, arity).
:- mode parse_name_and_arity(in, out, out) is semidet.
:- pred parse_pred_or_func_name_and_arity(module_name,
term(_T), pred_or_func, sym_name, arity).
:- mode parse_pred_or_func_name_and_arity(in, in, out, out, out) is semidet.
:- pred parse_pred_or_func_name_and_arity(term(_T), pred_or_func,
sym_name, arity).
:- mode parse_pred_or_func_name_and_arity(in, out, out, out) is semidet.
:- pred parse_pred_or_func_and_args(maybe(module_name), term(_T), term(_T),
string, maybe_pred_or_func(term(_T))).
:- mode parse_pred_or_func_and_args(in, in, in, in, out) is det.
:- pred parse_pred_or_func_and_args(term(_T), pred_or_func, sym_name,
list(term(_T))).
:- mode parse_pred_or_func_and_args(in, out, out, out) is semidet.
:- pred convert_mode_list(list(term), list(mode)).
:- mode convert_mode_list(in, out) is semidet.
:- pred convert_mode(term, mode).
:- mode convert_mode(in, out) is semidet.
:- pred convert_inst_list(list(term), list(inst)).
:- mode convert_inst_list(in, out) is semidet.
:- pred convert_inst(term, inst).
:- mode convert_inst(in, out) is semidet.
:- pred standard_det(string, determinism).
:- mode standard_det(in, out) is semidet.
% convert a "disjunction" (bunch of terms separated by ';'s) to a list
:- pred disjunction_to_list(term(T), list(term(T))).
:- mode disjunction_to_list(in, out) is det.
% convert a "conjunction" (bunch of terms separated by ','s) to a list
:- pred conjunction_to_list(term(T), list(term(T))).
:- mode conjunction_to_list(in, out) is det.
% list_to_conjunction(Context, First, Rest, Term).
% convert a list to a "conjunction" (bunch of terms separated by ','s)
:- pred list_to_conjunction(prog_context, term(T), list(term(T)), term(T)).
:- mode list_to_conjunction(in, in, in, out) is det.
% convert a "sum" (bunch of terms separated by '+' operators) to a list
:- pred sum_to_list(term(T), list(term(T))).
:- mode sum_to_list(in, out) is det.
% The following /3, /4 and /5 predicates are to be used for reporting
% warnings to stderr. This is preferable to using io__write_string, as
% this checks the halt-at-warn option.
%
% This predicate is best used by predicates that do not have access to
% module_info for a particular module. It sets the exit status to error
% when a warning is encountered in a module, and the --halt-at-warn
% option is set.
:- pred report_warning(string::in, io__state::di, io__state::uo) is det.
:- pred report_warning(io__output_stream::in, string::in, io__state::di,
io__state::uo) is det.
:- pred report_warning(string::in, int::in, string::in, io__state::di,
io__state::uo) is det.
%-----------------------------------------------------------------------------%
:- implementation.
:- import_module prog_io, prog_io_goal, options, globals.
% XXX we should not need to import hlds*.m here.
% But currently we need to import hlds_data.m for the `cons_id' type
% that is used in insts.
:- import_module hlds_data.
:- import_module bool, string, std_util, term.
add_context(error(M, T), _, error(M, T)).
add_context(ok(Item), Context, ok(Item, Context)).
parse_name_and_arity(ModuleName, PredAndArityTerm, SymName, Arity) :-
PredAndArityTerm = term__functor(term__atom("/"),
[PredNameTerm, ArityTerm], _),
parse_implicitly_qualified_term(ModuleName,
PredNameTerm, PredNameTerm, "", ok(SymName, [])),
ArityTerm = term__functor(term__integer(Arity), [], _).
parse_name_and_arity(PredAndArityTerm, SymName, Arity) :-
parse_name_and_arity(unqualified(""),
PredAndArityTerm, SymName, Arity).
parse_pred_or_func_name_and_arity(ModuleName, PorFPredAndArityTerm,
PredOrFunc, SymName, Arity) :-
PorFPredAndArityTerm = term__functor(term__atom(PredOrFuncStr),
Args, _),
( PredOrFuncStr = "pred", PredOrFunc = predicate
; PredOrFuncStr = "func", PredOrFunc = function
),
Args = [Arg],
parse_name_and_arity(ModuleName, Arg, SymName, Arity).
parse_pred_or_func_name_and_arity(PorFPredAndArityTerm,
PredOrFunc, SymName, Arity) :-
parse_pred_or_func_name_and_arity(unqualified(""),
PorFPredAndArityTerm, PredOrFunc, SymName, Arity).
parse_pred_or_func_and_args(Term, PredOrFunc, SymName, ArgTerms) :-
parse_pred_or_func_and_args(no, Term, Term, "",
ok(SymName, ArgTerms0 - MaybeRetTerm)),
(
MaybeRetTerm = yes(RetTerm),
PredOrFunc = function,
list__append(ArgTerms0, [RetTerm], ArgTerms)
;
MaybeRetTerm = no,
PredOrFunc = predicate,
ArgTerms = ArgTerms0
).
parse_pred_or_func_and_args(MaybeModuleName, PredAndArgsTerm, ErrorTerm,
Msg, PredAndArgsResult) :-
(
PredAndArgsTerm = term__functor(term__atom("="),
[FuncAndArgsTerm, FuncResultTerm], _)
->
FunctorTerm = FuncAndArgsTerm,
MaybeFuncResult = yes(FuncResultTerm)
;
FunctorTerm = PredAndArgsTerm,
MaybeFuncResult = no
),
(
MaybeModuleName = yes(ModuleName),
parse_implicitly_qualified_term(ModuleName, FunctorTerm,
ErrorTerm, Msg, Result)
;
MaybeModuleName = no,
parse_qualified_term(FunctorTerm, ErrorTerm, Msg, Result)
),
(
Result = ok(SymName, Args),
PredAndArgsResult = ok(SymName, Args - MaybeFuncResult)
;
Result = error(ErrorMsg, Term),
PredAndArgsResult = error(ErrorMsg, Term)
).
parse_list_of_vars(term__functor(term__atom("[]"), [], _), []).
parse_list_of_vars(term__functor(term__atom("."), [Head, Tail], _), [V|Vs]) :-
Head = term__variable(V),
parse_list_of_vars(Tail, Vs).
convert_mode_list([], []).
convert_mode_list([H0|T0], [H|T]) :-
convert_mode(H0, H),
convert_mode_list(T0, T).
%
% The new operator for mode declarations is >>.
% Previously we used ->, but this required a high-precedence
% operator such as :: for the :- mode delcaration.
%
% Using >> allows us to use == for the :- mode declaration.
%
% Eventually we can stop supporting :: and -> in :- mode
% declarations altogether.
%
convert_mode(Term, Mode) :-
(
(
Term = term__functor(term__atom(">>"),
[InstA, InstB], _)
;
Term = term__functor(term__atom("->"),
[InstA, InstB], _)
)
->
convert_inst(InstA, ConvertedInstA),
convert_inst(InstB, ConvertedInstB),
Mode = (ConvertedInstA -> ConvertedInstB)
;
% Handle higher-order predicate modes:
% a mode of the form
% pred(<Mode1>, <Mode2>, ...) is <Det>
% is an abbreviation for the inst mapping
% ( pred(<Mode1>, <Mode2>, ...) is <Det>
% -> pred(<Mode1>, <Mode2>, ...) is <Det>
% )
Term = term__functor(term__atom("is"), [PredTerm, DetTerm], _),
PredTerm = term__functor(term__atom("pred"), ArgModesTerms, _)
->
DetTerm = term__functor(term__atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(ArgModesTerms, ArgModes),
PredInstInfo = pred_inst_info(predicate, ArgModes, Detism),
Inst = ground(shared, yes(PredInstInfo)),
Mode = (Inst -> Inst)
;
% Handle higher-order function modes:
% a mode of the form
% func(<Mode1>, <Mode2>, ...) = <RetMode> is <Det>
% is an abbreviation for the inst mapping
% ( func(<Mode1>, <Mode2>, ...) = <RetMode> is <Det>
% -> func(<Mode1>, <Mode2>, ...) = <RetMode> is <Det>
% )
Term = term__functor(term__atom("is"), [EqTerm, DetTerm], _),
EqTerm = term__functor(term__atom("="),
[FuncTerm, RetModeTerm], _),
FuncTerm = term__functor(term__atom("func"), ArgModesTerms, _)
->
DetTerm = term__functor(term__atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(ArgModesTerms, ArgModes0),
convert_mode(RetModeTerm, RetMode),
list__append(ArgModes0, [RetMode], ArgModes),
FuncInstInfo = pred_inst_info(function, ArgModes, Detism),
Inst = ground(shared, yes(FuncInstInfo)),
Mode = (Inst -> Inst)
;
parse_qualified_term(Term, Term, "mode definition", R),
R = ok(Name, Args), % should improve error reporting
convert_inst_list(Args, ConvertedArgs),
Mode = user_defined_mode(Name, ConvertedArgs)
).
convert_inst_list([], []).
convert_inst_list([H0|T0], [H|T]) :-
convert_inst(H0, H),
convert_inst_list(T0, T).
convert_inst(term__variable(V0), inst_var(V)) :-
term__coerce_var(V0, V).
convert_inst(Term, Result) :-
Term = term__functor(Name, Args0, _Context),
% `free' insts
( Name = term__atom("free"), Args0 = [] ->
Result = free
% `any' insts
; Name = term__atom("any"), Args0 = [] ->
Result = any(shared)
; Name = term__atom("unique_any"), Args0 = [] ->
Result = any(unique)
; Name = term__atom("mostly_unique_any"), Args0 = [] ->
Result = any(mostly_unique)
; Name = term__atom("clobbered_any"), Args0 = [] ->
Result = any(clobbered)
; Name = term__atom("mostly_clobbered_any"), Args0 = [] ->
Result = any(mostly_clobbered)
% `ground' insts
; Name = term__atom("ground"), Args0 = [] ->
Result = ground(shared, no)
; Name = term__atom("unique"), Args0 = [] ->
Result = ground(unique, no)
; Name = term__atom("mostly_unique"), Args0 = [] ->
Result = ground(mostly_unique, no)
; Name = term__atom("clobbered"), Args0 = [] ->
Result = ground(clobbered, no)
; Name = term__atom("mostly_clobbered"), Args0 = [] ->
Result = ground(mostly_clobbered, no)
;
% The syntax for a higher-order pred inst is
%
% pred(<Mode1>, <Mode2>, ...) is <Detism>
%
% where <Mode1>, <Mode2>, ... are a list of modes,
% and <Detism> is a determinism.
Name = term__atom("is"), Args0 = [PredTerm, DetTerm],
PredTerm = term__functor(term__atom("pred"), ArgModesTerm, _)
->
DetTerm = term__functor(term__atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(ArgModesTerm, ArgModes),
PredInst = pred_inst_info(predicate, ArgModes, Detism),
Result = ground(shared, yes(PredInst))
;
% The syntax for a higher-order func inst is
%
% func(<Mode1>, <Mode2>, ...) = <RetMode> is <Detism>
%
% where <Mode1>, <Mode2>, ... are a list of modes,
% <RetMode> is a mode, and <Detism> is a determinism.
Name = term__atom("is"), Args0 = [EqTerm, DetTerm],
EqTerm = term__functor(term__atom("="),
[FuncTerm, RetModeTerm], _),
FuncTerm = term__functor(term__atom("func"), ArgModesTerm, _)
->
DetTerm = term__functor(term__atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(ArgModesTerm, ArgModes0),
convert_mode(RetModeTerm, RetMode),
list__append(ArgModes0, [RetMode], ArgModes),
FuncInst = pred_inst_info(function, ArgModes, Detism),
Result = ground(shared, yes(FuncInst))
% `not_reached' inst
; Name = term__atom("not_reached"), Args0 = [] ->
Result = not_reached
% `bound' insts
; Name = term__atom("bound"), Args0 = [Disj] ->
parse_bound_inst_list(Disj, shared, Result)
/* `bound_unique' is for backwards compatibility - use `unique' instead */
; Name = term__atom("bound_unique"), Args0 = [Disj] ->
parse_bound_inst_list(Disj, unique, Result)
; Name = term__atom("unique"), Args0 = [Disj] ->
parse_bound_inst_list(Disj, unique, Result)
; Name = term__atom("mostly_unique"), Args0 = [Disj] ->
parse_bound_inst_list(Disj, mostly_unique, Result)
% anything else must be a user-defined inst
;
parse_qualified_term(Term, Term, "inst",
ok(QualifiedName, Args1)),
convert_inst_list(Args1, Args),
Result = defined_inst(user_inst(QualifiedName, Args))
).
standard_det("det", det).
standard_det("cc_nondet", cc_nondet).
standard_det("cc_multi", cc_multidet).
standard_det("nondet", nondet).
standard_det("multi", multidet).
standard_det("multidet", multidet).
standard_det("semidet", semidet).
standard_det("erroneous", erroneous).
standard_det("failure", failure).
:- pred parse_bound_inst_list(term::in, uniqueness::in, (inst)::out) is semidet.
parse_bound_inst_list(Disj, Uniqueness, bound(Uniqueness, Functors)) :-
disjunction_to_list(Disj, List),
convert_bound_inst_list(List, Functors0),
list__sort(Functors0, Functors),
% check that the list doesn't specify the same functor twice
\+ (
list__append(_, SubList, Functors),
SubList = [F1, F2 | _],
F1 = functor(ConsId, _),
F2 = functor(ConsId, _)
).
:- pred convert_bound_inst_list(list(term), list(bound_inst)).
:- mode convert_bound_inst_list(in, out) is semidet.
convert_bound_inst_list([], []).
convert_bound_inst_list([H0|T0], [H|T]) :-
convert_bound_inst(H0, H),
convert_bound_inst_list(T0, T).
:- pred convert_bound_inst(term, bound_inst).
:- mode convert_bound_inst(in, out) is semidet.
convert_bound_inst(InstTerm, functor(ConsId, Args)) :-
InstTerm = term__functor(Functor, Args0, _),
( Functor = term__atom(_) ->
parse_qualified_term(InstTerm, InstTerm, "inst",
ok(SymName, Args1)),
list__length(Args1, Arity),
ConsId = cons(SymName, Arity)
;
Args1 = Args0,
list__length(Args1, Arity),
make_functor_cons_id(Functor, Arity, ConsId)
),
convert_inst_list(Args1, Args).
disjunction_to_list(Term, List) :-
binop_term_to_list(";", Term, List).
conjunction_to_list(Term, List) :-
binop_term_to_list(",", Term, List).
list_to_conjunction(_, Term, [], Term).
list_to_conjunction(Context, First, [Second | Rest], Term) :-
list_to_conjunction(Context, Second, Rest, Tail),
Term = term__functor(term__atom(","), [First, Tail], Context).
sum_to_list(Term, List) :-
binop_term_to_list("+", Term, List).
% general predicate to convert terms separated by any specified
% operator into a list
:- pred binop_term_to_list(string, term(T), list(term(T))).
:- mode binop_term_to_list(in, in, out) is det.
binop_term_to_list(Op, Term, List) :-
binop_term_to_list_2(Op, Term, [], List).
:- pred binop_term_to_list_2(string, term(T), list(term(T)), list(term(T))).
:- mode binop_term_to_list_2(in, in, in, out) is det.
binop_term_to_list_2(Op, Term, List0, List) :-
(
Term = term__functor(term__atom(Op), [L, R], _Context)
->
binop_term_to_list_2(Op, R, List0, List1),
binop_term_to_list_2(Op, L, List1, List)
;
List = [Term|List0]
).
report_warning(Message) -->
io__stderr_stream(StdErr),
globals__io_lookup_bool_option(halt_at_warn, HaltAtWarn),
( { HaltAtWarn = yes } ->
io__set_exit_status(1)
;
[]
),
io__write_string(StdErr, Message).
report_warning(Stream, Message) -->
globals__io_lookup_bool_option(halt_at_warn, HaltAtWarn),
( { HaltAtWarn = yes } ->
io__set_exit_status(1)
;
[]
),
io__write_string(Stream, Message).
report_warning(FileName, LineNum, Message) -->
{ string__format("%s:%3d: Warning: %s\n",
[s(FileName), i(LineNum), s(Message)], FullMessage) },
io__stderr_stream(StdErr),
io__write_string(StdErr, FullMessage),
globals__io_lookup_bool_option(halt_at_warn, HaltAtWarn),
( { HaltAtWarn = yes } ->
io__set_exit_status(1)
;
[]
).
%-----------------------------------------------------------------------------%