[mercury-users] errors with typeclasses
david wallin
david at wallin.cx
Fri Nov 3 05:51:55 AEDT 2000
>
>The fix is straight-forward:
>
> :- func list_add_chromosome(list_population,
> C) = list_population <= chromosome(C).
> :- mode list_add_chromosome(in, in) = out is det.
>
> list_add_chromosome(PopIn, Chromosome) = PopOut :-
> PopIn = list_population(List),
> PopOut = list_population([some_chromosome(Chromosome) | List]).
>
>Likewise for the other methods.
>
Ok, I did that (but changed the variable name to C1 for clarity).
This error seems strange to me (surprise!) since the
'some_chromosome' type declaration constrains C to implement the
chromosome typeclass, what's the problem ?
gusga.m:101: In clause for function `gusga:list_add_chromosome/2':
gusga.m:101: in argument 1 of functor `list_population/1':
gusga.m:101: in argument 1 of functor `./2':
gusga.m:101: in unification of argument
gusga.m:101: and term `some_chromosome(Chromosome)':
gusga.m:101: type error in argument(s) of functor `some_chromosome/1'.
gusga.m:101: Argument 1 (Chromosome) has type `C1',
gusga.m:101: expected type was `C'.
--david.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list