Skip to content

Pipe Utilities

Utility functions for pipeline debugging and control flow.

FunctionSignatureDescription
tap(T, (T) -> ()) -> TCall a function for side effects, return value unchanged
// Debug a pipeline without breaking the chain
let result = orders
|> Array.filter(.active)
|> tap(Console.log) // logs filtered orders, passes them through
|> Array.map(.total)
|> Array.reduce((sum, n) -> sum + n, 0)
// Use a closure for custom logging
let processed = data
|> transform
|> tap((x) -> Console.log("after transform:", x))
|> validate
// Works with any type
let name = " Alice "
|> String.trim
|> tap(Console.log) // logs "Alice"
|> String.toUpperCase // "ALICE"

tap is the pipeline equivalent of a console.log that doesn’t interrupt the flow. The function you pass receives the value but its return is ignored — the original value passes through unchanged.