Why does this compile? As you can see, I don't try to extract any values from the string but instead I specify a string in the first case of the ma ...
Why does this compile? As you can see, I don't try to extract any values from the string but instead I specify a string in the first case of the ma ...
I am getting an error in the extractor step (unapply method call). The error message is: Wrong number of arguments for the extractors. found 2; expect ...
I have a trait The problem here is I can't use the unapply defined in the trait without creating an extractor object. I would like to override the ...
This is a minimized example in which i try to implement a custom unapply method for case class Cube together with the default unapply method. Howeve ...
I encountered the following problem with implicits in Scala, using Shapeless's Generic.Aux: case class Complex(re: Double, im: Double) object Pr ...
I am trying out below example to understand unapply, Unfortunately, it fails with compilation error Cannot resolve symbol name, Cannot resolve symb ...
I am a student who studies Scala in korea. I am learning about pattern matching and unapply methods. The thing I am confused about is that Emergency o ...
Since extractors cannot take custom parameters (as answered in Stack Overflow: Can extractors be customized...), I try to find an alternative way of s ...
The following Scala code compiles fine: But if I replace the extractor by: Then compilation fails with: Why? Where does def isEmpty: Boolean ...
I am quite new to Scala and got a few unresolved problems with the following code: I get the following errors: Error: object Number is not a case ...
I am trying to understand the scala unapply method. Below is my understanding. Say if I have a Person object: class Person(val fname: String, val ln ...
Can't I use a generic on the unapply method of an extractor along with an implicit "converter" to support a pattern match specific to the parameterise ...
What is the time and space complexity for this: Does it depend on the implementation of Seq? Since IndexedSeq should have O(1) tail vs O(n) for Lin ...
I'm building a Scala Play app where events and data are persisted in Json format, and I'm trying to model users and the roles they're assigned. My thi ...
I just create a definition in scala for Naturals, and also a PLUS operation: And for the definition of Succ, i tryit not to use a Case class, for l ...
Am trying to implicitly deconstruct a class instance into a tuple to create a nicer DSL syntax. Here's a simplified example of what I'm trying to do: ...
I found a strange working construct in scala: which returns Apparently this already works partially for Vectors, but not pattern matching. can s ...
I would like to condense my evaluator thanks to a custom generic unapply function, which evaluates the argument and returns the value if it succeeds. ...
Reading this, I still have questions about unapply() that returns Boolean. If take a look at Scala Programming Book (2nd edition), page 602. There is ...
I have Scala code with some boilerplate, and I figure it's Scala, so I must be doing something wrong. I need some help figuring out how to remove the ...