<div dir="ltr">>
To paraphrase Neo, "I know Prolog".<br>
<br><div>> but I don't know Mercury and I am struggling to figure out this error....I</div><div>> am porting some old SWI code and it boils down to the fact that I obvuisly</div>

> 

don't truly understand what "det" means! Here is the code both as discrete<br>

> 

disjunctive clauses and a single big disjunct:<br>

> 

<br>
> 


:- pred char_type(char::in, chartype::out) is det.<br>

> 

<br>
> 


char_type(')', p_open).<br>

> 

char_type('(', p_close).<br>

> 

char_type(_, c_general).<br>

> 

<br>
> 


char_type(C, T) :-<br>> 

    (<br>
> 


        C = '(', T = p_open<br>

> 

    ;   C = ')', T = p_close<br>

> 

    ;   C = _,   T = c_general<br><div>

> 

    ). <br></div><br><div>What you probably want is to use if/then/conditionals instead of a disjunction. When Mercury sees the C = _, you're telling it that literally all characters should yield c_general, including the characters '(' and ')'. That means that for the inputs of ( and ), there are two solutions. Both the p_* solution, and c_general.<br></div><div><br></div><div>If you also have those rules above, then you're also doubling the solutions (which you won't want to do in most situations).</div></div>