本文へスキップ
Skillpedia
一般的なプログラミング48k · #4644

fp-pipe-ref

できること

これらのツールは、コード内の一連の処理を整理するのに役立ちます。`pipe`は、一連の変換をひとつの値にまとめて一度に適用します。`flow`は、複数の変換を組み合わせて、後で使える新しい関数を作ります。

使う場面

  • ✓データに対して複数の処理ステップを適用したいとき。
  • ✓特定の方法でデータを処理する、再利用可能な関数を作りたいとき。
  • ✓関数を一連の流れにまとめるライブラリを使うとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-pipe-ref/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-pipe-ref/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“文字列から余分なスペースを取り除き、大文字に変換してから、単語ごとに分割するにはどうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

`pipe`関数は初期値を受け取り、それを一つずつ順番に関数へ渡していきます。`flow`関数は複数の関数をまとめて新しい関数を作ります。その新しい関数は、同じ方法で別の値を処理するために使えます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

pipe & flow Quick Reference

pipe - Transform a Value

import { pipe } from 'fp-ts/function'

// pipe(startValue, fn1, fn2, fn3)
// = fn3(fn2(fn1(startValue)))

const result = pipe(
  '  hello world  ',
  s => s.trim(),
  s => s.toUpperCase(),
  s => s.split(' ')
)
// ['HELLO', 'WORLD']

flow - Create Reusable Pipeline

import { flow } from 'fp-ts/function'

// flow(fn1, fn2, fn3) returns a new function
const process = flow(
  (s: string) => s.trim(),
  s => s.toUpperCase(),
  s => s.split(' ')
)

process('  hello world  ') // ['HELLO', 'WORLD']
process('  foo bar  ')     // ['FOO', 'BAR']

When to Use

Use When
pipe Transform a specific value now
flow Create reusable transformation

With fp-ts Types

import * as O from 'fp-ts/Option'
import * as A from 'fp-ts/Array'

// Option chain
pipe(
  O.fromNullable(user),
  O.flatMap(u => O.fromNullable(u.email)),
  O.getOrElse(() => 'no email')
)

// Array chain
pipe(
  users,
  A.filter(u => u.active),
  A.map(u => u.name)
)

Common Pattern

// Data last enables partial application
const getActiveNames = flow(
  A.filter((u: User) => u.active),
  A.map(u => u.name)
)

// Reuse anywhere
getActiveNames(users1)
getActiveNames(users2)

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Reference scope

These are fp-ts 2.x fragments. Supply application variables, types, validators and imports, and check the installed version. map does not catch thrown exceptions. Task has no typed error channel; an improperly wrapped promise can still reject. Use tryCatch at fallible boundaries.

Official API: fp-ts modules.

よくある質問

`pipe`と`flow`の違いは何ですか?

`pipe`は、特定の値に対して今すぐ関数を順番に適用するためのものです。`flow`は、変換を組み合わせた新しい関数を作り、後で何度でも使うためのものです。

`pipe`と`flow`は何に使われますか?

関数をつなげたり組み合わせたりするのに役立ち、特に処理ステップが多いときに、コードを読みやすく整理できます。

どんなデータ型でも使えますか?

はい。`pipe`や`flow`の中で使う関数が、受け渡されるデータの型と互換性がある限り使えます。

詳細

作者による元の説明

Quick reference for pipe and flow. Use when user needs to chain functions, compose operations, or build data pipelines in fp-ts.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#4644
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル