Top "Case-class" questions

Case classes are regular classes which export their constructor parameters and which provide a recursive decomposition mechanism via pattern matching.

Why were the case classes without a parameter list deprecated?

Why were the case classes without a parameter list deprecated from Scala? And why does compiler suggest to use () as …

scala deprecated case-class
Should I use the final modifier when declaring case classes?

According to scala-wartremover static analysis tool I have to put "final" in front of every case classes I create: error …

scala static-analysis case-class scala-wartremover
Mixing in a trait dynamically

Having a trait trait Persisted { def id: Long } how do I implement a method that accepts an instance of any …

scala mixins case-class traits
Map flatten and flatmap not equivalent

I thought that Scala construct map(f).flatten was equivalent to flatMap(f). But with this example, it is not …

scala dictionary case-class
How to avoid scala's case class default toString function being overridden?

Scala case class has a default toString function. But when this case class extends a trait with an existing toString() …

scala case-class
Rename and Override equals method in case class

I want to define a trait named Ext that renames the existing equals method to equalsByAttributes and defines a new …

scala case-class
Using .tupled method when companion object is in class

I am in the process of migrating from Slick to Slick 2, and in Slick 2 you are meant to use the …

scala singleton slick case-class
Scala Macros: Making a Map out of fields of a class in Scala

Let's say that I have a lot of similar data classes. Here's an example class User which is defined as …

scala case-class scala-macros
Will the var members in case class affect case class's equality?

I have made heavy use of case classes in my code, replying on the underlying equality definitions of case class …

scala equality case-class algebraic-data-types
Scala: Case class unapply vs a manual implementation and type erasure

I'm trying to understand what Scala does with Case Classes that makes them somehow immune to type erasure warnings. Let's …

scala pattern-matching type-erasure case-class unapply