Skip to main content
Version: main

Patterns

Patterns are the technical building blocks of Barnum workflows. Each pattern isolates a single combinator concept with code pulled directly from the demos.

PatternCombinatorWhat it does
Serial executionpipe, .then()Chain steps sequentially
Parallel executionall, .iterate().map()Run work concurrently, collect results
BranchingbranchRoute on tagged unions
LoopingloopRetry until a condition is met
Error handlingtryCatchCatch failures, route to recovery
TimeoutwithTimeoutRace a handler against a timer
RacingraceFirst to finish wins
Context and variablesbind, bindInputShare data across pipeline steps
Early returnearlyReturnExit a scope before it finishes
RecursiondefineRecursiveFunctionsMutual and general recursion

For real-world workflows that combine these patterns, see the Repertoire.