When doing pattern matching, the Scala compiler will interpret o1 c1 o2
the same as c1(o1, o2)
. That’s why ::
works inside pattern matches too.
More Related Contents:
- Case class equality in Apache Spark
- How to override apply in a case class companion
- What does `:_*` (colon underscore star) do in Scala?
- Case objects vs Enumerations in Scala
- Cleaner way to update nested structures
- What is the difference between Scala’s case class and class?
- How to define schema for custom type in Spark SQL?
- Why does pattern matching in Scala not work with variables?
- How to pattern match on generic type in Scala?
- How to get around the Scala case class limit of 22 fields?
- Case class to map in Scala
- Mixing in a trait dynamically
- Scala multiple type pattern matching
- Pattern matching on generic type in Scala
- Why can’t I return a concrete subtype of A if a generic subtype of A is declared as return parameter?
- Easy idiomatic way to define Ordering for a simple case class
- Scala Macros: Making a Map out of fields of a class in Scala
- What is *so* wrong with case class inheritance?
- Scala case class inheritance
- Overload constructor for Scala’s Case Classes?
- Scala: short form of pattern matching that returns Boolean
- Why is parameter in contravariant position?
- Should I use the final modifier when declaring case classes?
- The argument types of an anonymous function must be fully known. (SLS 8.5)
- How to pattern match large Scala case classes?
- Scala 2.10 reflection, how do I extract the field values from a case class, i.e. field list from case class
- “dynamically” creating case classes with macros
- Understanding implicit in Scala
- How to use Scala’s this typing, abstract types, etc. to implement a Self type?
- How to force IntelliJ IDEA to reload dependencies from build.sbt after they changed?