I'm playing with reason, and I wanted to try to do the FFI for debug
in order to learn. I have this code
module Instance = {
type t;
external t : t = "" [@@bs.module];
};
module Debug = {
type t;
external createDebug : string => Instance.t = "debug" [@@bs.module];
};
and I'm trying to use it like this
open Debug;
let instance = Debug.createDebug "app";
instance "Hello World !!!";
but I get the following error
Error: This expression has type Debug.Instance.t
This is not a function; it cannot be applied.
Wasn't instance
supposed to be bind to a function? I also tried with
module Instance = {
type t;
external write : string => unit = "" [@@bs.send];
};
and
open Debug;
let instance = Debug.createDebug "app";
instance.write "Hello World !!!";
but I get
Error: Unbound record field write
What am I missing?