hearth-enum-rules

Derive type-class instances for sealed traits and Scala 3 enums via Enum.parse.

68|7|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/kubuszok/kindlings --skill hearth-enum-rules
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hearth-enum-rules
Source: https://github.com/kubuszok/kindlings/tree/main/docs/contributing/hearth-enum-rules
Command: npx skills add https://github.com/kubuszok/kindlings --skill hearth-enum-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines derivation of type-class instances for sealed traits and Scala 3 enums using Hearth's Enum.parse API, enabling exhaustive pattern matching and consistent error messages across Scala versions.

Core Features & Use Cases

  • Derive type-class instances for sealed hierarchies and Scala 3 enums via Enum.parse and per-case dispatch.
  • Distinguish singleton enum cases from case classes and handle recursive structures with supported tricks.
  • Support discriminator-style decoding in streaming codecs and wrapper inline modes for nested data.
  • Use in codebases that target Scala 2.13 or Scala 3, with forwards-compatibility and macro-based derivation.

Quick Start

Instantiate Enum.parse on your sealed trait or Scala 3 enum and combine per-case derivations with parMatchOn to cover all cases.

Frequently Asked Questions about hearth-enum-rules

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

FAQPage Schema
How do I derive type-class instances for sealed traits and Scala 3 enums?▼

You derive type-class instances for sealed traits and Scala 3 enums by instantiating Enum.parse and combining per-case derivations with parMatchOn to handle exhaustive pattern matching across all hierarchy branches.

What is the best way to handle singleton enum cases and recursive data structures in Scala?▼

Handling singleton enum cases and recursive data structures involves using Hearth's Enum.parse API with supported macro-derivation tricks to safely distinguish singletons from case classes during decoding.

Does macro-based enum derivation work with both Scala 2.13 and Scala 3 codebases?▼

Yes, macro-based enum derivation works with Scala 2.13 and Scala 3 codebases, providing forwards-compatibility and covering sealed traits, Scala 3 enums, and Java enums consistently across versions.

Can I use discriminator-style decoding for sealed trait hierarchies in streaming codecs?▼

Yes, you can use discriminator-style decoding for sealed trait hierarchies in streaming codecs, utilizing wrapper inline modes to handle nested data and ensure consistent error messages during dispatch.

Why do I need Enum.parse and parMatchOn for exhaustive dispatch in Scala?▼

You need Enum.parse and parMatchOn for exhaustive dispatch because they enable per-case derivations that cover all possible sealed trait branches and enum values, ensuring safe and complete pattern matching without missing cases.