[m-users.] "operator precedence error" - Mercury bug?
Volker Wysk
post at volker-wysk.de
Sat Oct 12 22:07:11 AEDT 2019
Am Samstag, den 12.10.2019, 20:00 +1100 schrieb Julien Fischer:
> Hi Volker,
>
> On Sat, 12 Oct 2019, Volker Wysk wrote:
>
> > This simple module won't compile:
> >
> > :- module test1.
> > :- interface.
> > :- import_module char.
> > :- pred f(char::in) is semidet.
> >
> > :- implementation.
> >
> > f(A) :-
> > A = '/'.
>
> You need to escape that using parentheses.
>
> f(A) :-
> A = ('/').
>
> Otherwise the compiler will treat that as the '/' operator.
> (Mercury doesn't have a specific syntax for character literalsm,
> they're
> just atoms.)
Hmm.. Couldn't find it in the Language Reference Manual.
It turns out that the single quotes are redundant:
f(A) :-
A = (/).
Thanks for explaining.
Volker
More information about the users
mailing list