MVFM

console/assert

Log an error if the assertion condition is false

const app = mvfm(prelude, console_);
const prog = app({ x: "number" }, ($) => {
  const ok = $.gt($.input.x, 0);
  return $.begin($.console.assert(ok, "x must be positive"), $.input.x);
});
await fold(defaults(app), injectInput(prog, { x: 5 }));
Ctrl+Enter