[m-users.] Compiler cannot infer determinism det when exhaustively pattern matching on a constant?

Anders Lundstedt mercury-users at anderslundstedt.se
Thu Aug 1 06:14:15 AEST 2024


For whatever it is worth, another workaround (turning the constant
into a constant function):

:- module test.
:- interface.
:- type t ---> c1; c2.
:- pred p(t::out) is det.
:- implementation.
:- func c(t) = t.
c(_) = c1.
p(A) :- c(c1) = C, ((C = c1, A = c2) ; (C = c2, A = c1)).


More information about the users mailing list