mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 19:33:46 +00:00
41 lines
694 B
Mathematica
41 lines
694 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module ambig_functor.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- type a
|
|
---> foo(int, string)
|
|
; bar.
|
|
|
|
:- type b
|
|
---> foo(string, int)
|
|
; bar.
|
|
|
|
:- type c(T)
|
|
---> foo(T, T)
|
|
; bar.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- pred ambig(T::in) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
( if ambig(foo(3, "string")) then
|
|
true
|
|
else
|
|
true
|
|
).
|
|
|
|
ambig(A1) :-
|
|
A1 = foo(3, _),
|
|
A1 = foo(_, "string").
|
|
|
|
:- end_module ambig_functor.
|