<div dir="auto">Thank you for your help it works very well.<div dir="auto"><br></div><div dir="auto">Maxime Gautin</div></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 26 juin 2018 à 16:51, Julien Fischer <<a href="mailto:jfischer@opturion.com">jfischer@opturion.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi,<br>
<br>
On Tue, 26 Jun 2018, Tomas By wrote:<br>
<br>
> On Tue, 26 Jun 2018 14:23:19 +0200, Maxime Gautin wrote:<br>
>> I have a compilation fail with the code I am studying. It is about an instance<br>
>> :- type token_list == list(token).<br>
>> :- instance parser_state(token_list) where [...]<br>
><br>
> It's in the manual here<br>
> <a href="http://mercurylang.org/information/doc-release/mercury_ref/Instance-declarations.html#Instance-declarations" rel="noreferrer noreferrer" target="_blank">http://mercurylang.org/information/doc-release/mercury_ref/Instance-declarations.html#Instance-declarations</a><br>
><br>
> "An ‘instance’ declaration gives a type for each parameter of the type<br>
> class. Each of these types must be either a type with no arguments, or<br>
> a polymorphic type whose arguments are all type variables. For example<br>
> int, list(T), bintree(K, V) and bintree(T, T) are allowed, but T and<br>
> list(int) are not. The types in an instance declaration must not be<br>
> abstract types which are elsewhere defined as equivalence types."<br>
><br>
> You can do something like<br>
><br>
> | :- type token_list ---> token_list(list(token)).<br>
><br>
> (I think).<br>
<br>
You can very definitely do that -- the standard library does it<br>
in quite a few places.<br>
<br>
Julien.</blockquote></div>