effect-collections-datastructs

Value-based data structures (Data.struct, tuple, array) and high-performance collections (Chunk, HashSet). Use for safe comparisons and pipelines.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill facilitates the implementation of value-based data structures and high-performance collections using the Effect library. It solves the limitations of reference-based equality in JavaScript by providing structural equality tools (Data.struct, Data.tuple) and optimized collection types (Chunk, HashSet) for building type-safe, functional, and performant TypeScript applications.

Use Cases

  • Structural Equality: Use Data.struct and Data.tuple to perform deep value comparisons of complex objects automatically, eliminating bugs caused by reference-based identity checks.
  • High-Performance Data Handling: Leverage the Chunk data structure for efficient, immutable array-like operations that outperform native arrays in functional programming pipelines.
  • Advanced Set Operations: Utilize HashSet to manage unique collections of complex objects where standard JavaScript Sets (which rely on reference) would fail to identify duplicates.
  • Functional Pipeline Optimization: Integrate specialized data structures into Effect-based workflows to ensure data integrity and improve runtime performance in large-scale software architectures.
nameeffect-collections-datastructs
descriptionValue-based data structures (Data.struct, tuple, array) and high-performance collections (Chunk, HashSet). Use for safe comparisons and pipelines.
allowed-toolsRead, Grep, Glob, Edit, Write

Data Structures & Collections

Structural Equality

import { Data, Equal } from "effect"
const a = Data.struct({ id: 1, name: "A" })
const b = Data.struct({ id: 1, name: "A" })
Equal.equals(a, b) // true

Tuples & Arrays

const t = Data.tuple(1, "x")
const arr = Data.array([1,2,3])

Chunk

import { Chunk } from "effect"
const items = Chunk.fromIterable([1,2,3])

HashSet

import { HashSet } from "effect"
const set = HashSet.fromIterable([1,2,3])

Local Source Reference

CRITICAL: Search local Effect source before implementing

The full Effect source code is available at docs/effect-source/. Always search the actual implementation before writing Effect code.

Key Source Files

  • Data: docs/effect-source/effect/src/Data.ts
  • Chunk: docs/effect-source/effect/src/Chunk.ts
  • HashSet: docs/effect-source/effect/src/HashSet.ts
  • Equal: docs/effect-source/effect/src/Equal.ts

Example Searches

# Find Data.struct and equality patterns
grep -F "Data.struct" docs/effect-source/effect/src/Data.ts
grep -F "Data.tuple" docs/effect-source/effect/src/Data.ts

# Find Chunk operations
grep -F "export" docs/effect-source/effect/src/Chunk.ts | grep -F "function"

# Study HashSet API
grep -F "export" docs/effect-source/effect/src/HashSet.ts | grep -F "function"

# Find Equal implementation
grep -F "equals" docs/effect-source/effect/src/Equal.ts

Workflow

  1. Identify the collection API you need (e.g., Chunk, HashSet)
  2. Search docs/effect-source/effect/src/ for the implementation
  3. Study the types and available operations
  4. Look at test files for usage examples
  5. Write your code based on real implementations

Real source code > documentation > assumptions

References