fp-async

Featured

Practical async patterns using TaskEither - clean pipelines instead of try/catch hell, with real API examples

AI & Automation 39,350 stars 6386 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Practical Async Patterns with fp-ts Stop writing nested try/catch blocks. Stop losing error context. Start building clean async pipelines that handle errors properly. **TaskEither is simply an async operation that tracks success or failure.** That's it. No fancy terminology needed. ## When to Use - You need async error handling in TypeScript with `TaskEither`. - The task involves wrapping Promises, composing API calls, or replacing nested `try/catch` flows. - You want practical fp-ts async patterns instead of academic explanations. ```typescript // TaskEither<Error, User> means: // "An async operation that either fails with Error or succeeds with User" ``` --- ## 1. Wrapping Promises Safely ### The Problem: Try/Catch Everywhere ```typescript // BEFORE: Try/catch hell async function getUserData(userId: string) { try { const response = await fetch(`/api/users/${userId}`) if (!response.ok) { throw new Error(`HTTP ${response.status}`) } const user = await response.json() try { const posts = await fetch(`/api/users/${userId}/posts`) if (!posts.ok) { throw new Error(`HTTP ${posts.status}`) } const postsData = await posts.json() return { user, posts: postsData } } catch (postsError) { // Now what? Return partial data? Rethrow? Log? console.error('Failed to fetch posts:', postsError) return { user, posts: [] } } } catch (error) { // Lost all context about what failed cons...

Details

Author
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category