I have two ml files: a.ml and b.ml.
In a.ml, I have:
module type Spec =
sig
type t
val transform : t -> float
end
module Make (Spec : Spec) = struct
let start mystream =
Stream.map (IData.app Spec.transform) mystream
end
In b.ml, I have:
module MySpec : A.Spec =
struct
type t = string
let transform x = float_of_string x
end
module B = A.Make(MySpec);;
B.start f;; (* this is where the error occurs *)
Stream and IData are two modules defined in two other seperate files:
stream.ml and iData.ml.
Stream has function map which is similar to List.map and IData has
function app that
applies a function to a value.
f has type string IData Stream. My a.ml could compile fine. Compiling
b.ml with a.cmi
gives the following error:
This expression (f) has type string IData.t Stream.t
but is here used with type MySpec.t IData.t Stream.t
The type constructor MySpec.t would escape its scope
What is really wrong here? I suspect it is because of the two separate
files stream.ml
and iData.ml that I have... Thanks!