mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 21:35:49 +00:00
Estimated hours taken: 18 Branches: main Move the univ, maybe, pair and unit types from std_util into their own modules. std_util still contains the general purpose higher-order programming constructs. library/std_util.m: Move univ, maybe, pair and unit (plus any other related types and procedures) into their own modules. library/maybe.m: New module. This contains the maybe and maybe_error types and the associated procedures. library/pair.m: New module. This contains the pair type and associated procedures. library/unit.m: New module. This contains the types unit/0 and unit/1. library/univ.m: New module. This contains the univ type and associated procedures. library/library.m: Add the new modules. library/private_builtin.m: Update the declaration of the type_ctor_info struct for univ. runtime/mercury.h: Update the declaration for the type_ctor_info struct for univ. runtime/mercury_mcpp.h: runtime/mercury_hlc_types.h: Update the definition of MR_Univ. runtime/mercury_init.h: Fix a comment: ML_type_name is now exported from type_desc.m. compiler/mlds_to_il.m: Update the the name of the module that defines univs (which are handled specially by the il code generator.) library/*.m: compiler/*.m: browser/*.m: mdbcomp/*.m: profiler/*.m: deep_profiler/*.m: Conform to the above changes. Import the new modules where they are needed; don't import std_util where it isn't needed. Fix formatting in lots of modules. Delete duplicate module imports. tests/*: Update the test suite to confrom to the above changes.
48 lines
1.1 KiB
Mathematica
48 lines
1.1 KiB
Mathematica
% This is a regression test for a bug in simplify/common.m where
|
|
% the pos(X, Y) deconstruction in the head of adj/2 was being propagated
|
|
% into the body of the lambda expression, changing the non-locals of the
|
|
% lambda expresssion, but the uni-modes field of the lambda construction
|
|
% unification was not being updated, resulting in an abort during lambda
|
|
% expansion.
|
|
:- module lambda_struct_bug.
|
|
|
|
:- interface.
|
|
|
|
:- import_module list, pair, set.
|
|
|
|
:- type pos
|
|
---> pos(int, int).
|
|
|
|
:- type adj
|
|
---> adj(pos, pos).
|
|
|
|
:- type maze == set(pair(pos, pos)).
|
|
|
|
:- pred adj(pos, list(adj)).
|
|
:- mode adj(in, out) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int, require, solutions.
|
|
|
|
adj(pos(X, Y), Adjs) :-
|
|
Pred = (pred(Adj::out) is nondet :-
|
|
(
|
|
X1 = X - 1,
|
|
Adj = adj(pos(X1, Y), pos(X, Y))
|
|
;
|
|
X1 = X + 1,
|
|
Adj = adj(pos(X1, Y), pos(X, Y))
|
|
;
|
|
Y1 = Y + 1,
|
|
Adj = adj(pos(X, Y1), pos(X, Y))
|
|
;
|
|
Y1 = Y - 1,
|
|
Adj = adj(pos(X, Y1), pos(X, Y))
|
|
),
|
|
Adj = adj(pos(A, B), _),
|
|
A >= 0, A =< 10, % XXX
|
|
B >= 0, B =< 10 % XXX
|
|
),
|
|
solutions(Pred, Adjs).
|