<div dir="ltr"><div><div><div><div><div><div><div>Hello everyone,<br><br></div>I have a compilation fail with the code I am studying. It is about an instance<br><br>:- type token_list == list(token).<br><br>:- instance parser_state(token_list) where [<br><br>        get_token(end,[],[]),<br>        get_token(T,[T | Ts], Ts),<br><br>        unget_token(T, Ts) = [T | Ts]<br>].<br><br></div><div>token is a type defined on another file.<br></div><div><br></div>The typeclass is also declared on another file : <br><br>:- typeclass parser_state(T) where [<br>    pred get_token(token, T, T),<br>    mode get_token(out, in, out) is det,<br>    func unget_token(token, T) = T,<br>    mode unget_token(in, in) = out is det<br>].<br><br></div>And this is the error : <br><br>imputgen_bin.m:061: In instance declaration for<br>imputgen_bin.m:061:   `int_parser.parser_state(list.list(scanner.token))':<br>imputgen_bin.m:061:   the first argument is a type whose first argument is not<br>imputgen_bin.m:061:   a variable.<br>imputgen_bin.m:061:   (Types in instance declarations must be functors with<br>imputgen_bin.m:061:   variables as arguments.)<br><br></div>I am not very familiar with instance in Mercury, and I don't understand what I have to modify. I hope you can help me. <br><br></div>Thanks, <br><br></div>Maxime Gautin<br></div>Polytech Marseille<br><div><br></div></div>