[m-users.] Document "Module typeclasses should be instantiated in the interface"
fabrice nicol
fabrnicol at gmail.com
Fri May 14 23:00:49 AEST 2021
Ok Peter, but the issue revolves around 'eval' being used in a parent
file, not 'eval_foo'.
Anyhow, Zoltan's reply lightened my bulb: any such warnings would be
hard to implement and maintain as linking takes place at low level.
Fabrice
>> Stimulat[ing] piece of coding.
>>
>> If I understand you well, there might be convoluted cases in which an
>> exported typeclass, without an abstract instance in the interface, could
>> probably be used in a parent file if the type instantiation is somehow
>> bootstrapped (or 'lifted up') by existential quantification plus symbol
>> export in the interface of the module. But (reassuringly?) this does not
>> work. Yes, your module m1 does build into a library, but the ominous
>> "unsatisfiable typeclass contraint" error message pops up again if you
>> try to import module m1 into a parent file and use 'eval' like this:
> It was intended to be used in this way:
>
> :- import_module m1.
>
> main(!IO) :-
> Foo = make_foo,
> eval_foo(Foo, I),
> io.format("this int: %d\n", [i(I)], !IO).
>
> Peter
More information about the users
mailing list