Patterns
Patterns are the technical building blocks of Barnum workflows. Each pattern isolates a single combinator concept with code pulled directly from the demos.
| Pattern | Combinator | What it does |
|---|---|---|
| Serial execution | pipe, .then() | Chain steps sequentially |
| Parallel execution | all, forEach | Run work concurrently, collect results |
| Branching | branch | Route on tagged unions |
| Looping | loop | Retry until a condition is met |
| Error handling | tryCatch | Catch failures, route to recovery |
| Timeout | withTimeout | Race a handler against a timer |
| Racing | race | First to finish wins |
| Context and variables | bind, bindInput | Share data across pipeline steps |
| Early return | earlyReturn | Exit a scope before it finishes |
| Recursion | defineRecursiveFunctions | Mutual and general recursion |
For real-world workflows that combine these patterns, see the Repertoire.