Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1829

How to bind to a function that returns a class

$
0
0

Ok this looks better

module type Foo = {
  type t
}
external getFooClass: unit => module(Foo) = "getFoo"

module FooInterface = {
  type t
  external make: module(Foo) => module(Foo with type t = t) = "new" 
  @send external bar: module(Foo with type t = t) => unit = "bar"
}

let foo = getFooClass()->FooInterface.make
foo->FooInterface.bar

Viewing all articles
Browse latest Browse all 1829

Trending Articles