[m-users.] Error instance Mercury
maxime.gautin at gmail.com
Wed Jun 27 18:24:53 AEST 2018
Thank you for your help it works very well.
Le mar. 26 juin 2018 à 16:51, Julien Fischer <jfischer at opturion.com> a
> On Tue, 26 Jun 2018, Tomas By wrote:
> > On Tue, 26 Jun 2018 14:23:19 +0200, Maxime Gautin wrote:
> >> 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 [...]
> > It's in the manual here
> > "An ‘instance’ declaration gives a type for each parameter of the type
> > class. Each of these types must be either a type with no arguments, or
> > a polymorphic type whose arguments are all type variables. For example
> > int, list(T), bintree(K, V) and bintree(T, T) are allowed, but T and
> > list(int) are not. The types in an instance declaration must not be
> > abstract types which are elsewhere defined as equivalence types."
> > You can do something like
> > | :- type token_list ---> token_list(list(token)).
> > (I think).
> You can very definitely do that -- the standard library does it
> in quite a few places.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users