MVFM

fiber/timeout

Timeout an expression with a fallback value if it exceeds the limit

// 1. make an app
const app = mvfm(prelude, fiber);

// 2. make a program
const prog = app({ x: "number" }, ($) => {
  const computation = $.mul($.input.x, $.input.x);
  return $.timeout(computation, 5000, -1);
});

// 3. run
await fold(
  defaults(app),
  injectInput(prog, { x: 7 })
);
Ctrl+Enter