mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
49 lines
1.1 KiB
Mathematica
49 lines
1.1 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module mpj5.
|
|
:- interface.
|
|
|
|
:- import_module bool.
|
|
:- import_module list.
|
|
|
|
:- typeclass coll(E, C) <= (C -> E) where [
|
|
func e = C,
|
|
func i(E, C) = C,
|
|
pred m(E::in, C::in) is semidet
|
|
].
|
|
|
|
:- type w(T)
|
|
---> w(T).
|
|
:- type cf(T)
|
|
---> cf(func(T) = bool).
|
|
|
|
:- instance coll(int, int).
|
|
|
|
% We don't support duplicated type vars in instances yet, so these cases
|
|
% are disabled for the moment.
|
|
% :- instance coll(w(T), list(T)).
|
|
% :- instance coll(w(T), cf(T)).
|
|
|
|
:- implementation.
|
|
:- import_module int.
|
|
|
|
:- instance coll(int, int) where [
|
|
(e = 0),
|
|
(i(N, B) = B \/ (1 << N)),
|
|
(m(N, B) :- B /\ (1 << N) \= 0)
|
|
].
|
|
|
|
% :- instance coll(w(T), list(T)) where [
|
|
% (e = []),
|
|
% (i(w(E), L) = [E | L]),
|
|
% (m(w(E), L) :- list__member(E, L))
|
|
% ].
|
|
|
|
% :- instance coll(w(T), cf(T)) where [
|
|
% (e = cf(func(_) = no)),
|
|
% (i(w(E), cf(F)) = cf(func(X) = ( X = E -> yes ; F(X) ))),
|
|
% (m(w(E), cf(F)) :- F(E) = yes)
|
|
% ].
|