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
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • 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].

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • 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