Relaxing type checking when using 'with type' construction in modules -


I have defined two module types and two modules

  module type FOO = sig E end module type bar = cig type t and module Foo: FOO = struct type e = interval end module bar: bar = strip type t = int end   

Then I define a functor Module Fun (F: Foo) (B: ​​Type B = with EF) = Stret Type x = String End

(This is a Toy Now, if I define a module, please

  
  module blah = funny (foo) (bar)   

get me

  error: signature mismatch: modules do not match: sig type t = bar.t end sig type t = foo.e finally Type declarations do not match: Type is not typed in t = bar-10 t = Foo.e   

Although both barta and Foo.e as int on Speaking is OCaml Bar.t and Foo .e Separation is the only way that the typing system works and it is understandable to consider both these types of general forms (the last paragraph of the CEF).

Question : Sometimes I want that I should check the typing because they can be considered equal to my purposes. Is there any way to relax it?


Using the suggestion of gaseous to remove pressure, the above code

  module type FOO = sig type e end module type BAR = Cig type T and module FU = Stripe Type E = Int End Module Bar = Strip Type T = Int End Module Fun (F: Fu In Type E = Int) (B: ​​type T = type with type =) type x = Fe * BT end module Bla = Funny (Foo) (bar)   

Whichever compile weirdly, I

  # f To: bla.x = (x, x) ;; Val f: Foo.e - & gt; Bla.x = & lt; Funny & gt;   

Question : Why does it assume that x is Foo.e ? It can also be that Bar.t

The problem is that you Define how foo and bar : module fu: FOO = ... . By placing this signature here, you "seal" the module and type the essence. It can not be reversed You should delete : FOO from here, and use it later when you need an intangible one. You can also use the module FU: (FOO = int with e FOO) = ... .

Comments