purify

Model data and effects with Codecs, Maybe, Either, and EitherAsync in TypeScript.

Updated Nov 19, 2025
One-click install
npx skills add https://github.com/manutej/fstar-labs --skill purify
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: purify
Source: https://github.com/manutej/fstar-labs/tree/main/.claude/skills/purify
Command: npx skills add https://github.com/manutej/fstar-labs --skill purify

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Purify provides ergonomic, production-ready primitives for functional programming in TypeScript, reducing boilerplate and improving type safety with algebraic data types, codecs, and async workflows.

Core Features & Use Cases

  • Codecs for runtime validation: define and decode external data safely.
  • Monadic data types: Maybe, Either, EitherAsync, MaybeAsync for robust error handling.
  • Composable utilities: List, Tuple, Function aids for cleaner code.
  • Use Case: Build a resilient API client that validates responses, handles errors, and composes async tasks declaratively.

Quick Start

Install the purify-ts package and import the modules in your TypeScript project:

  • npm install purify-ts
  • Then in your code: import { Maybe, Just } from 'purify-ts';

Frequently Asked Questions about purify

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle runtime validation for API responses in TypeScript?

Codecs enable runtime validation in TypeScript by decoding external API responses safely. By defining codecs for your data structures, you ensure that incoming JSON matches expected types before it reaches your application logic.

What is the best way to manage monadic error handling for async pipelines in TypeScript?

The best way to manage monadic error handling in async TypeScript pipelines is using EitherAsync and MaybeAsync. These constructs allow you to compose asynchronous tasks declaratively while safely propagating errors without relying on try-catch blocks.

How do I model nullable data safely without runtime errors in TypeScript?

You can model nullable data safely in TypeScript using the Maybe monad. Maybe represents the presence or absence of a value, allowing you to apply transformations and access properties without risking undefined runtime errors.

Can I use functional programming constructs to build a resilient API client in TypeScript?

Yes, you can build a resilient API client in TypeScript using functional programming constructs like Either and Codecs. These primitives validate responses, manage errors declaratively, and compose async tasks cleanly without nested try-catch blocks.

Do I need to install additional dependencies to use purify for functional programming in TypeScript?

You need to install the purify-ts package via npm to use these functional programming constructs. Once installed, you can import modules like Maybe, Just, and Codecs directly into your TypeScript project to start building safe data workflows.

Why should I use Either instead of standard try-catch for error handling in TypeScript?

You should use Either instead of try-catch to represent failures as explicit values in your type signatures. Either provides composable error handling, making it clear which functions can fail and forcing callers to handle both success and failure cases.