[m-users.] Predicate declared nondet error: mode mismatch in disjunction.

Julien Fischer jfischer at opturion.com
Thu May 20 21:24:38 AEST 2021


On Thu, 20 May 2021, Zoltan Somogyi wrote:

> 2021-05-20 21:03 GMT+10:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
>> Hi,
>> 
>> I have created a predicate called bifmap/2 that is declared as nondet, as given the same input string, the body of a token, it could produce more than one result as I allow alternative forms in my language eg, “o>” and “emit”, “λ” and “defun” etc. I am trying to implem,ent a help functio for my repl, and the issue I have is again trying to figure out what the compiler is telling me, the error is:
>> 
>> mmc -s hlc.gc -O4 -E --make felt
>> Making Mercury/int3s/words.int3
>> Making Mercury/ints/words.int
>> Making Mercury/cs/words.c
>> words.m:230: In clause for `bifmap(in, out)':
>> words.m:230:   mode mismatch in disjunction.
>> words.m:230:   The variable `HeadVar__2' is ground in 118 out of 119 branches.
>> words.m:230:   It has the following instantiation states.
>> words.m:109:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:109:       unique(binaryop(unique(gt))).
>> words.m:110:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:110:       unique(binaryop(unique(lt))).
>> words.m:111:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:111:       unique(binaryop(unique(gte))).
>> words.m:112:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:112:       unique(binaryop(unique(lte))).
>> words.m:113:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:113:       unique(binaryop(unique(neq))).
>> words.m:114:     In this branch, `HeadVar__2' has the ground instantiatedness
>> ... error log truncated, see `words.err' for the complete log.
>> ** Error making `Mercury/cs/words.c'.
>> make: *** [felt] Error 1
>> The terminal process "/bin/zsh '-c', 'make'" terminated with exit code: 2. 
>
> You must be using an old Mercury compiler. On recent compilers, the error
> message is much shorter and to the point:
>
> words.m:215: In clause for `bifmap(in, out)':
> words.m:215:   mode mismatch in disjunction.
> words.m:215:   The variable `HeadVar__2' is ground in 118 out of 119 branches.
> words.m:201:     In this branch, `HeadVar__2' is free.
>
> This info is also in the error output you would have got, but your error log got truncated
> before that.

I think Sean is using a fairly recent compiler, but he's compiling with
verbose errors enabled.  In this case that means it will print out the
inferred inst of *every* branch.   (The actual problem gets lost amongst
all that.)

Julien.


More information about the users mailing list