- Home
- Skills
- Whatiskadudoing
- Fp Ts Skills
- Fp Fundamentals
fp-fundamentals_skill
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-fundamentals- SKILL.md31.5 KB
Overview
This skill teaches core functional programming concepts: pure functions, currying, composition, and pointfree style. It focuses on practical patterns that make TypeScript code predictable, testable, and easy to compose. Learn guidelines and common pitfalls before using fp-ts types like Option, Either, and Task.
How this skill works
The skill examines how to write deterministic, side-effect-free functions and how to convert impure code into pure forms via dependency injection and data-last APIs. It demonstrates currying and partial application to enable reusable helpers, and shows composition (pipe/flow) and pointfree style to build clear pipelines. Each concept includes practical examples, common mistakes, and fixes you can apply immediately.
When to use it
- When you want functions that are easy to test and memoize
- When building reusable data transformation pipelines with pipe/flow
- Before introducing fp-ts types (Option, Either, Task) into your codebase
- When you need safe parallelizable logic without shared mutable state
- When composing small utilities into larger domain workflows
Best practices
- Prefer pure functions: return new values and inject dependencies instead of using globals
- Use data-last, curried functions to enable clean partial application and pipe usage
- Compose small, single-purpose functions and name grouped pipelines for readability
- Avoid over-currying: curry only to the level your callers need
- Make argument order consistent (config -> options -> data) across your codebase
Example use cases
- Transforming API responses through a typed pipeline that validates, maps, and formats data
- Creating reusable UI data mappers in React using curried map/filter helpers
- Turning impure database or I/O calls into Task/IO descriptions for controlled execution
- Building composable validation chains that return Either results for error handling
- Converting utility libraries to data-last functions so they work with pipe/flow
FAQ
No. Pointfree can reduce boilerplate but may hurt readability for complex pipelines. Use it where it clarifies intent and keep named steps for longer flows.
When should I stop currying a function?
Stop currying when callers find it awkward to use. Curry to the level that enables partial application for your common use cases, and group related parameters when needed.