Thanks for the explanations. You’re right that removing the :SA
constraint in the body of B
makes it compile. Great!
As I try to understand the logic here, some comments:
I wrote this because in the following example:
module type SA = sig type t val of_int: int -> t val print: t -> unit end
module A = struct
type t = int
let of_int i = i
let print = print_int
end
module B (A:SA) = struct
module A = A
let print_twice i = A.print i; A.print i
end
module Btop = B (A)
the type of Btop.print_twice
is inferred as int -> unit
. So (A:SA)
in the functor input signature is not enough to make the type abstract when the functor is applied.