Files
mercury/compiler/maybe_util.m
Zoltan Somogyi 6bdd8b84ee Move maybe_changed to maybe_succeeded.m and rename it.
compiler/maybe_util.m:
    Move the maybe_changed type from several modules of the compiler
    to maybe_succeeded.m, and rename it to maybe_util.m.

compiler/libs.m:
compiler/notes/compiler_design.html:
    Implement and document the rename.

compiler/common.m:
compiler/compile_target_code.m:
compiler/decide_type_repn.m:
compiler/det_analysis.m:
compiler/det_util.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/file_util.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/module_cmds.m:
compiler/parse_tree_out.m:
compiler/process_util.m:
compiler/recompilation.version.m:
compiler/write_module_interface_files.m:
    Conform to the changes above.
2023-04-21 17:24:30 +10:00

45 lines
1.3 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Copyright (C) 2021 The Mercury team.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%---------------------------------------------------------------------------%
:- module libs.maybe_util.
:- interface.
:- import_module list.
:- type maybe_succeeded
---> did_not_succeed
; succeeded.
:- func maybe_succeeded `and` maybe_succeeded = maybe_succeeded.
:- func and_list(list(maybe_succeeded)) = maybe_succeeded.
%---------------------%
:- type maybe_changed
---> unchanged
; changed.
%---------------------------------------------------------------------------%
:- implementation.
SucceededA `and` SucceededB =
( if SucceededA = succeeded, SucceededB = succeeded then
succeeded
else
did_not_succeed
).
and_list(Succeededs) = AllSucceeded :-
AllSucceeded = list.foldl(and, Succeededs, succeeded).
%---------------------------------------------------------------------------%
:- end_module libs.maybe_util.
%---------------------------------------------------------------------------%