effect-typeclass-design

Implement Effect typeclasses with curried signatures and dual data-first and data-last APIs.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-typeclass-design-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-typeclass-design
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-typeclass-design
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-typeclass-design-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Designing reusable abstractions in Effect TypeScript often leads to inconsistent APIs that only support one calling style, forcing consumers to choose between direct calls and pipe-friendly composition. ## Core Features & Use Cases - Curried Typeclass Functions: Build fully curried typeclass operations that take the typeclass instance first, enabling partial application for filtering and mapping. - Dual APIs with Function.dual: Provide both data-first (uncurried) and data-last (curried) variants of every operation from a single implementation. - Use Case: Define a Durable typeclass for domain types like Appointment, then reuse operations such as isMoreThan and OrderByDuration across any type that has a duration, in both pipe chains and direct calls. ## Quick Start Implement a Durable typeclass in Effect with curried dual APIs so I can use it both in pipes and as direct function calls.

Frequently Asked Questions about effect-typeclass-design

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

FAQPage Schema
How do I implement a typeclass in Effect TypeScript?

Define an interface describing the operations for a generic type A, then write functions that take the typeclass instance as the first parameter and curry the remaining arguments. This enables partial application and reuse across any type with an instance.

How to create dual data-first and data-last APIs with Function.dual?

Use Function.dual from effect/Function with the arity of the data-first form and a single uncurried implementation. It returns an overloaded function supporting both direct calls like f(self, arg) and pipe-friendly calls like pipe(self, f(arg)).

What is the difference between data-first and data-last in Effect?

Data-first functions take the data as the first argument for direct calls, while data-last functions take it last so they fit into pipe compositions. Dual APIs expose both forms from one implementation.

When should I use curried typeclass functions?

Use currying when you need partial application, such as passing isMoreThan(D)(minimum) directly to Array.filter or reusing a configured predicate. It also keeps the typeclass instance as the stable first parameter.

Can I derive an Order instance from a typeclass in Effect?

Yes, use Order.mapInput to project an existing Order onto your type through the typeclass accessor, for example Order.mapInput(Duration.Order, D.getDuration) to order values by their duration.