|
Multi-parameter case classes: msg#00246lang.scala
I am trying to write a case class that can be partially applied, but get a compile-time error when I try to case match. Here is a trivialised example of what I am trying to do: sealed abstract class S { } case object T extends S { } final case class U(xs: String)(ys: String) extends S { } object X { def f(s: S): Unit = s match { case T => Console.println("t") // COMPILE-TIME ERROR // case U(xs)(ys) => Console.println("u " + xs + " " + ys) } } How do I do what it is that I wanna do? Cheers for any tips. -- Tony Morris http://tmorris.net/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Tail recursion -> while (?): 00246, Rich Dougherty |
|---|---|
| Next by Date: | Scala generics for automatic differentiation: 00246, Michel Salim |
| Previous by Thread: | pattern matching works strange for an O'Caml programmeri: 00246, Alexander Sergeev |
| Next by Thread: | Fwd: Multi-parameter case classes: 00246, Burak Emir |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |