pipe and flow are utility functions for composing sequences of transformations. Both are fully typed — each function’s return type becomes the next function’s argument type, with no loss of type information.
pipe(value, ...fns)
Takes an initial value and passes it through a sequence of functions left-to-right. Returns the output of the final function.
flow(...fns)
Composes functions into a single reusable function without an initial value. Call the result later with your input. Think of it as a named, reusable pipeline.
flow is useful for defining transforms you want to pass as callbacks or store as constants:
Built-in .pipe() on Result and ResultAsync
Result and ResultAsync have their own .pipe() method. It behaves like pipe, but is Result-aware: if any step returns an Err, the chain short-circuits and subsequent functions are skipped.
ResultAsync: