You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behaviour of the following example is unexpected:
module type Print=sigtypetvalf : t -> unitend
implicit moduleInt=structtypet = intletf_=()endmodule type Pair=sigtype('a,'b) t = 'a*'b
implicit moduleMake {A:Print} {B:Print} : Printwithtype t = (A.t, B.t) t
(*(*works*) implicit module Make {A:Print} {B:Print} : Print with type t = A.t * B.t *)valcreate : 'a -> 'b -> ('a,'b) tendmodulePair : Pair=structtype('a,'b) t = 'a*'b
implicit moduleMake {A:Print} {B:Print} =structtypet = A.t*B.tletf_=()endletcreatexy= (x,y)
endopen implicit Pair(*(*works*) open Pair *)letprint{A:Print} (x:A.t) =A.f x
let _ = print (Pair.create 33)
It fails to compile with Error: No instance found for implicit A.. What I would expect is that it correctly resolves the module Pair.Make {Int} {Int}.
My use-case of interest is when type ('a,'b) t is abstract, but this seems irrelevant for the problem.
It compiles as expected when you either replace the type by its definition in the declaration of Make (uncomment the first comment) or if you replace open implicit with a plain open (uncomment the second comment).
I looked at other bugs, but it did not seem to fit already-reported ones.
The text was updated successfully, but these errors were encountered:
The behaviour of the following example is unexpected:
It fails to compile with
Error: No instance found for implicit A.
. What I would expect is that it correctly resolves the modulePair.Make {Int} {Int}
.My use-case of interest is when
type ('a,'b) t
is abstract, but this seems irrelevant for the problem.It compiles as expected when you either replace the type by its definition in the declaration of
Make
(uncomment the first comment) or if you replaceopen implicit
with a plainopen
(uncomment the second comment).I looked at other bugs, but it did not seem to fit already-reported ones.
The text was updated successfully, but these errors were encountered: