[m-users.] Error instance Mercury
maxime.gautin at gmail.com
Tue Jun 26 22:23:19 AEST 2018
I have a compilation fail with the code I am studying. It is about an
:- type token_list == list(token).
:- instance parser_state(token_list) where [
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: the first argument is a type whose first argument is
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users