fp-pipe-flow_skill

This skill helps you master function composition in fp-ts using pipe and flow to build elegant, type-safe data pipelines.

2

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill whatiskadudoing/fp-ts-skills --skill fp-pipe-flow

  • SKILL.md15.3 KB

Overview

This skill teaches function composition in fp-ts using pipe and flow to build elegant, type-safe data transformation pipelines. It focuses on practical patterns for synchronous and asynchronous workflows with fp-ts types like Option, Either, Task, and ReaderTaskEither. Expect clear rules for when to use pipe vs flow, currying and arity handling, error handling patterns, and examples you can reuse immediately.

How this skill works

It explains pipe as the immediate execution operator that threads a value through functions, and flow as the deferred composer that returns a new function. The skill shows how to compose unary functions, curry multi-argument functions, and combine fp-ts data types (Option, Either, Task, TaskEither, ReaderTaskEither) into readable pipelines. It also covers parallel vs sequential execution, error accumulation, and Do/sequence patterns.

When to use it

  • Use pipe when you have a concrete value and want readable, left-to-right transformation.
  • Use flow to define reusable transformation functions or callbacks before you have an input value.
  • Use fp-ts combinators (flatMap/map/etc.) inside pipelines to work with Option, Either, Task, and Reader types.
  • Use parallel applicatives (ApplicativePar) to run independent async tasks concurrently.
  • Use Do notation or sequenceS for dependent steps and clearer error propagation.

Best practices

  • Keep each pipeline step small and focused; extract named functions for intent and reuse.
  • Prefer flow for reusable transforms and pipe for one-off value flows to improve readability.
  • Currying or partial application for multi-argument functions keeps pipelines unary and composable.
  • Handle errors at the level where you can respond meaningfully; use Validation/Appplicative to accumulate errors when needed.
  • Group related operations and comment pipeline sections (filter, transform, sort) to maintain clarity.

Example use cases

  • Transforming and filtering arrays: pipe(users, A.filter(isActive), A.map(formatName), A.sort(...)).
  • Fetching and composing async resources: pipe(fetchUser(id), TE.flatMap(fetchUserPosts), TE.map(combine)).
  • Validating and accumulating errors: use getApplicativeValidation with Either and sequenceS to report multiple validation failures.
  • Environment-dependent flows: ReaderTaskEither pipelines for dependency injection (repos, services, logger).
  • Fallback chains: combine Option.alt to try env, file, then defaults for config resolution.

FAQ

Use pipe when you already have the value and want immediate, readable transformation. Use flow when building a reusable function pipeline to apply later.

How do I compose functions that take multiple arguments?

Prefer currying or partial application so each pipeline step is unary. Alternatively wrap the call in an inline arrow function for one-off usage.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational