[m-users.] Error instance Mercury
Maxime Gautin
maxime.gautin at gmail.com
Tue Jun 26 22:23:19 AEST 2018
Hello everyone,
I have a compilation fail with the code I am studying. It is about an
instance
:- type token_list == list(token).
:- instance parser_state(token_list) where [
get_token(end,[],[]),
get_token(T,[T | Ts], Ts),
unget_token(T, Ts) = [T | Ts]
].
token is a type defined on another file.
The typeclass is also declared on another file :
:- typeclass parser_state(T) where [
pred get_token(token, T, T),
mode get_token(out, in, out) is det,
func unget_token(token, T) = T,
mode unget_token(in, in) = out is det
].
And this is the error :
imputgen_bin.m:061: In instance declaration for
imputgen_bin.m:061: `int_parser.parser_state(list.list(scanner.token))':
imputgen_bin.m:061: the first argument is a type whose first argument is
not
imputgen_bin.m:061: a variable.
imputgen_bin.m:061: (Types in instance declarations must be functors with
imputgen_bin.m:061: variables as arguments.)
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.
Thanks,
Maxime Gautin
Polytech Marseille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20180626/81b2bdf8/attachment.html>
More information about the users
mailing list