fp-ts Pipe and Flow Composition
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)))
More from whatiskadudoing/fp-ts-skills
functional programming fundamentals
Core FP concepts including pure functions, currying, composition, and pointfree style - the foundation for mastering functional TypeScript
81fp-ts-backend
Functional programming patterns for Node.js/Deno backend development using fp-ts, ReaderTaskEither, and functional dependency injection
52pragmatic functional programming
A practical, jargon-free guide to functional programming - the 80/20 approach that gets results without the academic overhead
40functional programming in react
Practical patterns for using fp-ts with React - hooks, state, forms, data fetching. Works with React 18/19, Next.js 14/15.
40fp-immutable
Practical immutability patterns in TypeScript - spread operators, nested updates, readonly types, and when mutation is actually fine
39fp-ts-validation
Validation patterns using fp-ts with error accumulation, form validation, and API input validation
39