Open ohad opened 7 years ago
I think the problem here is that foo
takes an implicit module that contains a functor and add constraints on an instance of this functor (the B.R(INT).t
parameter).
Constraints propagated from an instance of a functor are not yet supported.
OK, thanks. I think I'm giving up on using implicits for what I was trying to use.
I also think that if I change the implicit argument to the explicit argument, the program shouldn't type-check anyway, because a first class module cannot be bound in a type signature, right? I.e.:
val foo : (module B : BAR ) -> B.R(INT).t -> int
is not a valid OCaml program (with first-class modules).
(The above bug is still a bug, because the compiler shouldn't crash ;).)
Indeed, normal ocaml arrows don't bind anything in the environment.
The correct syntax is then (module BAR)
and there is no way to refer to the type of an applied functor.
(let foo (module B : BAR) = ...
is accepted, but the typechecker will enforce that no name from B escapes)
With the attached file path_error.ml.txt the following crashes: