case-class
Pattern matching on nested types in Scala
I am trying to implement something that is effectively an enumeration in Scala. I would like to do that using case classes so that the compiler is able to detect any non-exhaustive pattern matches.[详细]
2023-02-28 01:54 分类:问答Efficient map with case class as a key in Scala?
A following C code uses enum and array as efficient \"map\" from enum to anything: enum Color { ColorRed, ColorGreen, ColorBlue, ColorSize};[详细]
2023-02-07 09:13 分类:问答Why are case objects serializable and case classes not?
I am playing with this example http://scala.sygneca.com/code/remoteactors to learn how remote actors work in Scala (2.8.0). In particular I slightly modified how the messages send by the actors are de[详细]
2023-01-22 16:31 分类:问答Cleaner way to update nested structures
Say I have got following two case classes: case class Address(street: String, city: String, state: String, zipCode: Int)[详细]
2023-01-19 21:52 分类:问答Bidirectional reference with case classes
Is it possible to implement a bi-directional tree in a case class.This seems like it should be easy, but I\'m getting stumped[详细]
2023-01-16 23:22 分类:问答case class and traits
I want create a special calculator. I think that case class is a good idea for operations: sealed class Expr[详细]
2023-01-14 21:45 分类:问答Implicit conversion to instantiate a sealed class
I have this inheritance sealed abstract class MyValue case class MyString(s:String) extends MyValue case class MyBoolean(b:Boolean) extends MyValue[详细]
2023-01-12 13:01 分类:问答Appending a label to immutable case classes in Scala
Im trying to create a parser for a small language with commands including labels and goto: ... lazy val cmds= opt(\"{\")~>rep(cmd<~opt(\";\"))<~opt(\"}\") ^^ {...}[详细]
2023-01-11 06:53 分类:问答A case class, inheriting from a class, is having issues being used as constructor parameter
I have this case class define: class Protocol(protocol:String) object Protocol { def apply(protocol:String) :Protocol = {[详细]
2023-01-06 02:59 分类:问答Why do case class companion objects extend FunctionN?
When you create a case class, the compiler creates a corresponding companion object with a few of the case class goodies: an apply factory method matching the primary constructor, equals, hashCode, an[详细]
2023-01-03 09:15 分类:问答