본문으로 건너뛰기
Skillpedia
일반 코딩48k · #4652

fp-types-ref

하는 일

fp-ts 라이브러리에서 올바른 타입(예: Option, Either, Task)을 골라 TypeScript 코드를 체계적으로 만들도록 돕습니다. 특히 값이 없을 수 있거나 오류가 날 수 있는 비동기 작업을 다룰 때 유용합니다.

사용하는 경우

  • ✓Option, Either, Task, TaskEither 중에서 선택해야 할 때.
  • ✓fp-ts 타입을 가져오는 방법을 모를 때.
  • ✓흔한 fp-ts 패턴에 대한 빠른 안내가 필요할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-types-ref/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“실패할 수 있고 비동기인 함수에는 어떤 fp-ts 타입을 써야 하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 간단한 순서도를 사용해 작업이 비동기인지, 실패할 수 있는지, 값이 없을 수 있는지에 따라 선택하도록 안내합니다. 가져오기와 흔한 패턴을 위한 코드 예제도 제공합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

fp-ts Quick Reference

When to Use

  • You need help choosing between Option, Either, Task, TaskEither, or related fp-ts types.
  • The task is about imports, decision guidance, or selecting the right abstraction for a TypeScript flow.
  • You want a compact reference for common fp-ts type choices and patterns.

Which Type Should I Use?

Is the operation async?
├─ NO: Does it involve errors?
│   ├─ YES → Either<Error, Value>
│   └─ NO: Might value be missing?
│       ├─ YES → Option<Value>
│       └─ NO → Just use the value
└─ YES: Does it involve errors?
    ├─ YES → TaskEither<Error, Value>
    └─ NO: Might value be missing?
        ├─ YES → TaskOption<Value>
        └─ NO → Task<Value>

Common Imports

// Core
import { pipe, flow } from 'fp-ts/function'

// Types
import * as O from 'fp-ts/Option'      // Maybe exists
import * as E from 'fp-ts/Either'      // Success or failure
import * as TE from 'fp-ts/TaskEither' // Async + failure
import * as T from 'fp-ts/Task'        // Lazy async; no typed error channel
import * as A from 'fp-ts/Array'       // Array utilities

One-Line Patterns

Need Code
Wrap nullable O.fromNullable(value)
Default value O.getOrElse(() => fallbackValue)
Transform if exists O.map(fn)
Chain optionals O.flatMap(fn)
Wrap try/catch E.tryCatch(() => risky(), toError)
Wrap async TE.tryCatch(() => fetch(url), toError)
Run pipe pipe(value, fn1, fn2, fn3)

Pattern Match

// Option
pipe(maybe, O.match(
  () => 'nothing',
  (val) => `got ${val}`
))

// Either
pipe(result, E.match(
  (err) => `error: ${err}`,
  (val) => `success: ${val}`
))

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.

자주 묻는 질문

Option, Either, Task란 무엇인가요?

값이 없을 수 있는 상황(Option), 성공하거나 실패할 수 있는 작업(Either), 완료에 시간이 걸리는 작업(Task)처럼 흔한 프로그래밍 상황을 더 안전하고 체계적으로 다루도록 돕는 타입입니다.

「비동기」는 무슨 뜻인가요?

작업이 즉시 일어나지 않고 미래의 어느 시점에 일어난다는 뜻입니다. 서버에서 데이터를 가져오거나 파일을 읽는 것이 예입니다.

fp-ts란 무엇인가요?

함수형 프로그래밍 개념을 TypeScript에 가져와 더 견고하고 예측 가능한 코드를 작성하도록 돕는 인기 있는 라이브러리입니다.

상세 정보

작성자의 원본 설명

Quick reference for fp-ts types. Use when user asks which type to use, needs Option/Either/Task decision help, or wants fp-ts imports.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4652
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬