<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">The error:<div class=""><div class="">ast.m:042: In clause for predicate `on_lexer'/1:</div><div class="">ast.m:042:   error: ambiguous overloading causes type ambiguity.</div><div class="">ast.m:042:   Possible type assignments include:</div><div class="">ast.m:042:   Tokens: `pred(list.list(lexer.token), list.list(lexer.token))' or</div><div class="">ast.m:042:   `(pred list.list(lexer.token))'</div><div class="">ast.m:042:   You will need to add an explicit type qualification to resolve the</div><div class="">ast.m:042:   type ambiguity. The way to add an explicit type qualification is</div><div class="">ast.m:042:   to use "with_type". For details see the</div><div class="">ast.m:042:   "Explicit type qualification" sub-section of the "Data-terms"</div><div class="">ast.m:042:   section of the "Syntax" chapter of the Mercury language reference</div><div class="">ast.m:042:   manual.</div></div><div class=""><br class=""></div><div class="">the ast.m code:</div><div class=""><br class=""></div><div class=""><font face="Courier New" style="font-size: 14px;" class="">[42]on_lexer(Lx) :-<br class="">      Tokens = list.filter(<br class="">          % is_comment,<br class="">          (pred(T::in) is semidet :- Ty = tok_type(T), not (Ty = c1 ; Ty = cn)),<br class="">          tokens(Lx)<br class="">      ),<br class=""><br class="">      trace[io(!Dbg), runtime(env("FELT_AST"))]<br class="">      (atrace(0, "on_lexer: input tokens:\n%s\n",<br class="">          [s(string(Tokens))], !Dbg)),<br class=""><br class="">      true.</font></div><div class=""><span style="font-size: 12px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12px;" class=""><br class=""></span></div><div class="">the predicate tokens is an auto generated field accessor from my lexer state record:</div><div class=""><font face="Courier New" style="font-size: 14px;" class="">:- type lexcon<br class="">        --->    lexcon(<br class="">                    buf        :: string,<br class="">                    status     :: lexer_status,<br class="">                    prev_char  :: maybe(char),<br class="">                    buf_pos    :: location,<br class="">                    tab_size   :: int,<br class="">                    str_delim  :: char,<br class="">                    tok_start  :: location,<br class="">                    tokens     :: list(token)<br class="">        ).</font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class=""><br class=""></span></font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class=""><br class=""></span></font></div><div class="">Sadly, I just cannot understand what I have done wrong to create ambiguity. tokens/1 returns list(token), given:</div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class=""><br class=""></span></font></div><div class=""><font style="font-size: 14px;" face="Courier New" class="">:- type location<br class="">        --->    pos(index::int, line::int, col::int).<br class="">:- type token<br class="">        --->    tk(location, string)<br class="">        ;       op(location) ; cp(location)<br class="">        ;       ol(location) ; cl(location)<br class="">        ;       om(location) ; cm(location)<br class="">        ;       c1(location, string) ; cn(location, string)<br class="">        ;       s1(location, string) ; s2(location, string)<br class="">        .</font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class=""><br class=""></span></font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class="">Thanks again,</span></font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class="">Sean.</span></font></div><div class=""><font face="Helvetica" class=""><span style="font-size: 12px;" class=""><br class=""></span></font></div></body></html>