Traits

Implement equality, hashing, and ordering semantics in Effect-TS.

8|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/andrueandersoncs/claude-skill-effect-ts --skill traits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Traits
Source: https://github.com/andrueandersoncs/claude-skill-effect-ts/tree/main/skills/traits
Command: npx skills add https://github.com/andrueandersoncs/claude-skill-effect-ts --skill traits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often need clear, reliable semantics for equality, hashing, and ordering when working with Effect-TS. This skill provides guidance on implementing Equal, Hash, Equivalence, and Order, ensuring consistent behavior across value objects and collections.

Core Features & Use Cases

  • Equal and Hash integration: Use Data.Class to automatically derive equality and hash behavior for domain types.
  • Custom equivalence and ordering: Compose custom equivalence relations and ordering strategies for complex data.
  • Use Case: Create a value object like Point with deterministic equality and stable sorting in sets and maps.

Quick Start

Create a simple Point type using Data.Class and compare two instances for equality.

Frequently Asked Questions about Traits

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

FAQPage Schema
How do I implement equality and hashing in Effect-TS?

You implement equality and hashing in Effect-TS by using Data.Class to automatically derive Equal and Hash behavior for domain types. This ensures deterministic equality checks across value objects.

How do I create custom equivalence and ordering for complex data in Effect?

To create custom equivalence and ordering in Effect, you compose custom Equivalence and Order trait interfaces. This allows you to define specific comparison strategies for complex data structures and ensure stable sorting.

What is the best way to compare value objects like Point in Effect?

The best way to compare value objects like Point in Effect is by using Data.Class or Schema.Class. This automatically derives deterministic equality and stable hashing for your types.

Does Data.Class automatically derive equality for nested properties in Effect?

Data.Class automatically derives equality and hashing for your defined properties in Effect. You create a simple type like Point, and it handles the structural comparison automatically.

Why does my object equality check fail in Effect-TS collections?

Object equality checks fail in Effect-TS collections when types lack proper Equal and Hash implementations. Using Data.Class ensures consistent behavior across sets and maps by providing derived equality semantics.