Simple, Naïve, and Wrong: More than you wanted to know about Scala Case Classes

This page summarizes the projects mentioned and recommended in the original post on /r/scala

Our great sponsors
  • Onboard AI - Learn any GitHub repo in 59 seconds
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • SaaSHub - Software Alternatives and Reviews
  • Enumeratum

    A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations.

    And for exactly the same reasons one shouldn't override equals and hashCode in a case class, they shouldn't manually implement an enumeration and instead let a well-tested macro (2.x) or the compiler itself (3.x) handle reliably doing the automated code generation. The more code that is generated by the compiler, the smaller the defects, technical debt, and security vulnerability surface areas.

  • refined

    Refinement types for Scala

    This is more or less how derivation works when you want to use something like Refined types (it exposes Validate[Type, Refinement] typeclass if I remember correctly). Enumeratum exposes Enum[A], and newtypes expose Coercible[From, To].

  • Onboard AI

    Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at

  • Scapegoat

    Scala compiler plugin for static code analysis

    I've since figured this out (Scapegoat/FinalModifierOnCaseClass and WartRemover/FinalCaseClass). I plan to add it to the next version of the article.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts