Pure layout descriptors
document, page, section, and table are prelude forms with explicit slot types and child contracts—no arbitrary scripts inside layout.
Forma for Effect PDF · pre-alpha exploration
Invoices, statements, and compliance packets combine layout trees with structured business data—usually held together by untyped templates and headless browser glue. @forma/effect-pdf is a pre-alpha Forma prelude that defines document, page, section, and table with checked data bindings. Prelude checking and IR projection run live in the browser sandbox today; PDF generation and live Preview Portal rendering are planned.
(document invoice :data Invoice (page :size :letter (section :title "Summary" …) (table :rows :lines …))) │ │ read → project → check → IR ▼ Canonical Document IR (checked today) └─→ Preview Portal & PDF (planned)
Pre-alpha exploration · live Preview Portal rendering is planned · open sandbox
00 The problem
Document pipelines usually scatter schema definitions, HTML templates, and PDF rendering scripts across separate layers. Rename a field on an invoice record or mistype a table column, and the template renders undefined or a blank total. Forma makes document structure and data bindings part of one checked tree, so mismatches fail at the line you wrote.
Document vocabulary
Layout and data bindings checked together.
In the sandbox, @forma/effect-pdf defines document, page, section, and table as ordinary prelude forms. Each form declares its allowed children, page options, and typed data bindings.
Because document trees are pure declarations, they cannot perform ambient I/O or fetch records mid-render. All data enters through explicit typed bindings, and the compiler projects the verified tree into canonical Document IR.
(type LineItem
{:sku String :qty Int :unit-cents Int})
(type Invoice
{:number String
:customer String
:lines (List LineItem)
:total-cents Int})
(document customer-invoice
:data Invoice
(page :size :letter
(section :title "Bill To" :bind :customer)
(table :rows :lines
:columns [:sku :qty :unit-cents])
(section :title "Total Due" :bind :total-cents)))Preview & rendering
What runs today vs. what comes next.
Today, the Effect PDF sandbox runs Forma's real typechecker over src/invoice.lisp and the mounted @forma/effect-pdf prelude. You can edit bindings, test diagnostics, and modify prelude descriptors with copy-on-write overrides.
Live Preview Portal rendering—turning the checked Document IR into a visual page preview and downloadable PDF bytes inside the browser—is planned, not yet implemented. The sandbox includes the Preview Portal shell to show where live rendering plugs into the checked IR pipeline.
03 Architecture
Separating checked structure from PDF byte emission keeps templates small, reviewable, and portable across renderers.
document, page, section, and table are prelude forms with explicit slot types and child contracts—no arbitrary scripts inside layout.
Bindings connect sections and table columns to declared schemas so missing fields and wrong types are caught before rendering.
Every passing document projects to structured IR that a future TypeScript or Effect PDF renderer can consume without re-parsing Lisp.
Open @forma/effect-pdf in the sandbox file tree to see how each document form is defined and customize it live.
04 Limits
This is a pre-alpha exploration of declarative document modeling. Most of a real PDF stack sits outside it today.
05 Fit
Open the Effect PDF sandbox to edit src/invoice.lisp, break a binding, and inspect the @forma/effect-pdf prelude descriptors directly.