[m-users.] Document "Module typeclasses should be instantiated in the interface"
    Peter Wang 
    novalazy at gmail.com
       
    Fri May 14 22:09:46 AEST 2021
    
    
  
On Fri, 14 May 2021 12:59:36 +0200 fabrice nicol <fabrnicol at gmail.com> wrote:
> 
> Stimulated 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