The contact
EmailContact is what a rule can see about one recipient. Your host computes its fields, including :due-in, the hours until each journey's next scheduled email.
--- layout: home title: Forma for email automation description: Email and marketing automation rules in a typed Lisp. A small prelude defines lanes, decisions, and predicates; a TypeScript-engine prototype checks each rule and generates Effect TypeScript before anything sends. sidebar: false aside: false pageClass: forma-index forma-email ---
Forma for email automation · pre-alpha prototype
Who gets an email, when, and how fast. Write a campaign rule as a small Lisp form. Forma checks every lane, every decision, and every delivery failure, then generates plain Effect TypeScript for your sender. The whole vocabulary is one short prelude, shown in full below.
Prelude-defined vocabulary · TypeScript engine only · current limits
01 The pitch
The prelude
EmailContact is what a rule can see about one recipient. Your host computes its fields, including :due-in, the hours until each journey's next scheduled email.
EmailDecision closes the set of answers. send, defer, and skip are ordinary typed functions that build them.
tag?, domain?, and due? are ordinary functions too. They take the contact first; a rule leaves it out.
rule declares the syntax and an emit hook for the exported rule record. The linker adds the rule's lanes as EmailLane, passes the contact to predicates, and reads 6h or 2d as hours.
03 In action
This workbench runs the email prelude and the Effect checker in your browser. The rule is followed by ordinary Effect code: a Mailer service and a run-warmup operation that delivers whatever the rule decides. Introduce error misspells the Gmail lane. Open Effect TypeScript to see fresh generated code.
04 What it catches
Each diagnostic below is real compiler output for a one-line edit to the program above, located in the author's source.
05 The output
This is the complete generated module for the program above, checked against effect@4.1.1. The conformance case compares it with a golden, typechecks it under strict settings, and runs a harness against recording, rate-limited, and bouncing mailers.
EmailContact, EmailLane, and EmailDecision are Effect schemas, so a host can decode contacts from a CRM export before a rule sees them.
LaunchWarmup3 exports the rule's name, its decide function, and perHour for each lane. A scheduler reads rates from it.
Mailer is a Context.Service. You implement it for your provider and provide the layer when you run runWarmup.
runWarmup has type Effect<EmailDecision, never, Mailer>. Every declared provider failure has already become a decision.
06 Limits
This is a small prototype on a pre-alpha language. The working part is the checker; most of an email platform is outside it.
EmailContact. Adding a field or predicate means editing the prelude.07 Next
Three proposed RFCs would turn checked rules into rehearsed ones. None of them is implemented.
Tests in Forma would let a rule carry its own examples: a customer is skipped, a new signup is deferred, a Gmail address takes the Gmail lane.
Checked evaluation pauses each host call with its source span, so a dry run could answer every delivery with "recorded, not sent."
Host-call journals would record a real send, replay a changed rule against it, and report the first contact who would now get a different email.
Should suppression be a separate, always-checked clause rather than first-match? Where should journey timing and multi-email sequences live? Should templates be checked against the contact schema too?
08 Fit
The prelude is the language. The conformance case shows the generated module and the mailers that exercise it.