[m-users.] Is this a compiler bug?

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Hi.

The following program fails to compile:

:- module pairbug.
:- interface.
:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.
:- import_module pair, string.

:- pred p(pair(string, string)::out, io::di, io::uo) is det.
p("foo" - "bar", !IO).

main(!IO) :-
    p(A - B, !IO).    % <- line 19


The message is:

pairbug.m:006: In `main'(di, uo):
pairbug.m:006:   error: determinism declaration not satisfied.
pairbug.m:006:   Declared `det', inferred `semidet'.
pairbug.m:006:   The reason for the difference is the following.
pairbug.m:019:   In argument 1 of call to predicate `pairbug.p'/3:
pairbug.m:019:   unification with `V_9' can fail.


But the following works:

main(!IO) :-
    p(P, !IO),
    P = A - B.


This must either be something stupid or a compiler bug...


Cheers
Volker

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmNv4+4ACgkQ+K4ydFOs
HoUgnw/+KiS6J6b6WvOzJgtibzr5ngtf0Lny/qy0dvwN4yDXHprSCrL+0sc+1K3A
lbA/5mfpvReTmn1b7x5kQ1RgzTXcSyjPAlQU9Q+X4sTTn5z/P+wARJuH7TQGL+al
fBIEee0bKRPlFhfHho2x9jaEC2/owcyABGQsjpk4ldQuNx/rZSUkOvugzs2iaK0y
3gEG8X0jOEIV50vA9SykfmgkZVIExrnSYEMjQZeg+XhwSfQdFDZioqNiiGk9O+dV
0Y2j4ZT5sIpnBMwNkaDn3khlBqfCSIIKBRWX/1QiLmXuSK3yYY3BYbUFf/5QAh1C
4WVGgUn44J9dGgevNFzyX8/LqEbELue2RuDqlX5HOkleCbIlhuQIF4oWcskjmpp4
Td4fRIKjiOKABRU86YHJSZ1RTR+tKDGQykQ9w9sERZJTH7p48OlIeE+puzBcuxkf
/0kTeq1qcgpd5u0QHaj3mRGmHHtNZaVatFwt2/9zEkSzA5bEzEaw9FWb4utye+BN
bGVMR+CLqVSCVsmP6CQ3GahXAbOsbmYgMiQ0DhxHRCDxyecO3mSB/wAL53lebJtq
bT0yGH2Sb4NWKqLX3gUpMzdQ7pQtPmSXiwJ2WdghPD0a0JoNZQLnGfL/LPLWiGQp
EfYBYy4hiNRe7fpaVaPeEcmX3LBCy+LYynxqr0dsmefD6DQDcgg=
=iS3Y
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.