MVFM

core

MVFM is an extensible tagless-final DSL for deterministic TypeScript programs. Every program follows a three-step pattern:

  • mvfm(plugins...) creates an app with the plugins you need.
  • app(schema, builder) defines a program from a schema and builder function.
  • fold(interpreter, program) executes the program with a concrete interpreter.

MVFM stands for Minimum Viable Free Monad. The eventual goal is to reimplement TypeScript in TypeScript.

const app = mvfm(prelude, console_);

const prog = app({ greeting: "string" }, ($) =>
  $.console.log($.concat($.input.greeting, " — have fun!"))
);

await fold(
  defaults(app),
  injectInput(prog, { greeting: "hello, mvfm" })
);
Ctrl+Enter