Files
mercury/tests/valid/fundeps_poly_instance.m
Zoltan Somogyi fdd141bf77 Clean up the tests in the other test directories.
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.
2015-02-16 12:32:18 +11:00

31 lines
994 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module fundeps_poly_instance.
:- interface.
:- typeclass foo(A, B) <= (A -> B) where [].
:- typeclass bar(A, B, C) <= foo(A, B) where [].
:- typeclass baz(A, B, C) <= ((A -> B, C), bar(A, B, C)) where [].
:- implementation.
:- type t(T)
---> t(T).
% B is in the range of the functional dependency we must satisfy,
% but it is determined from A by the functional dependencies on the
% constraint.
%
:- instance foo(t(A), t(B)) <= foo(A, B) where [].
:- instance bar(t(A), t(B), t(C)) <= foo(A, B) where [].
% B and C are in the range of the functional dependency we must
% satisfy. B is determined from the foo/2 constraint, and C is
% determined by an ancestor of the bar/3 constraint.
:- instance baz(t(A), t(B), t(C)) <= (foo(A, B), bar(B, C, A)) where [].