Issue with Retrying Code not functioning

var foo = 0;

var incEff = (n) => Effect.succeed(n + 1)

var bar = await Effect.runPromise(
  pipe(
    Effect.succeed(foo),
    Effect.flatMap(incEff),
    Effect.flatMap(n => Effect.if(n < 3, {
      onTrue: () => Effect.succeed(n),
      onFalse: () => Effect.fail("too small: " + n)
    })),
    Effect.retry({times: 5})
  )
);

Please can I get a hint as to why this isn't retrying? I'd expect the outcome of this code to be bar == 4
Was this page helpful?