fp-ts Pipe and Flow Composition
Installation
SKILL.md
fp-ts Pipe and Flow Composition
Function composition is the heart of functional programming. fp-ts provides two powerful utilities for composing functions: pipe and flow. This guide covers everything you need to build elegant, type-safe pipelines.
Imports
import { pipe, flow, identity } from 'fp-ts/function'
Understanding Pipe vs Flow
pipe: Immediate Execution with a Starting Value
pipe takes a value and passes it through a series of functions, executing immediately.
// pipe(value, fn1, fn2, fn3) === fn3(fn2(fn1(value)))