I am new to Reason, currently trying to convert a personal project from js to reason. Mostly it has been easy so far apart from async stuff.
I am not able to call my function recursively with delay.
I have a function getPrice which returns a promise of int
type getPrice = unit => Js.Promise.t(int)
I want to make another function checkPrice, which checks the current price by given user price endlessly unless condition is met.
let rec checkPrice = (userPrice) =>
  Js.Promise.(
   getPrice()
    |> then_(
     (currentPrice) =>
       if (currentPrice >= userPrice) {
         resolve(currentPrice)
       } else {
         /* call this function with setTimeout */
         checkPrice(userPrice)
       }
   )
);
But I am getting type mismatch saying setTimeout should be of type unit 
 
    