typelang × Deno Showcase

Strict Functional Subset

Every module runs inside the same expression-first subset enforced by the custom linter.

  • No implicit mutation, classes, or control statements.
  • Human-readable diffs—business logic reads top-to-bottom.
  • Guaranteed compatibility with seq()/par() orchestration.
Read the subset guide

Algebraic Effects Runtime

Stack composable handlers to swap Console, State, Async, Http, and user-defined capabilities.

  • Abort- and cleanup-aware cancellation scopes.
  • Runtime checks ensure every instruction has a handler.
  • Handlers stay pure—return Result and let the runtime resolve it.
Explore effects walkthrough

Lightweight HTTP Server

Deno-native server with zero dependencies, middleware chaining, and effect-driven route handlers.

  • Composable middleware: logger, CORS, auth, rate-limit, static.
  • Routes compile to regex once and stay in memory.
  • HTMX showcase renders progressively via server-side partials.
See the server anatomy

Type-Safe Effect Handling

Design custom interfaces with defineInterface() and interpret them with tiny handlers.

  • Capabilities appear explicitly in Result signatures.
  • swap handler stacks per request for testing or SSR.
  • Resource scopes clean up on success, failure, or cancel.
Master handler design

Pure Workflow Sequencing

State + Console + Exception with seq()

Why it matters

  • `seq()` advances workflow state while keeping data immutable.
  • Console + Exception handlers yield audit trails automatically.
seq()StateConsolematch()pipe() Console.capture()State.with()Exception.tryCatch() Workflow state
Program
// Multi-capability type alias: record-based effect composition
// Order-independent, self-documenting
type WorkflowCaps = Readonly<{
  console: typeof Console.spec;
  state: ReturnType<typeof State.spec<WorkflowState>>;
  exception: typeof Exception.spec;
}>;

const workflow = (): Eff<WorkflowSnapshot, WorkflowCaps> =>
  seq()
    .let("state", () => State.get<WorkflowState>())
    .then((state) => state.stage)
    .then((stage) => nextStage(stage))
    .let("next", (next) => next)
    .then((next) => ({ stage: next, note: stageNote(next) }))
    .let("event", (event) => event)
    .tap((event) => Console.log(`Stage → ${stageLabel(event.stage)}`))
    .tapWith(({ state, event }) => {
      const history = appendEvent(state.history, event);
      return State.put({ stage: event.stage, history });
    })
    .returnWith(({ state, event }) => {
      const history = appendEvent(state.history, event);
      return { stage: event.stage, history };
    });

Awaiting execution

Console output, timeline events and workflow state snapshots will render here after you run the program.

Handlers: Console.capture() · State.with() · Exception.tryCatch()