Hi,
the following works:
case class Foo(a: Int, b: String)
object Foo extends((Int, String) => Foo) {
Foo.tupled
}
Carlos Encarnacion <
encarnaci...@gmail.com> wrote:
> If that is true, it's quite unfortunate. Is there any workaround?
(...)
> On Friday, June 1, 2012 7:36:56 PM UTC-4, Carlos Encarnacion wrote:
> Hi,
>
> case class A(v: String)
> object A {
> A.tupled // compile error
> }
>
> What am I missing here?
Aside from the already-mentioned fact that custom companion objects of
case classes aren't functions by default, the "tupled" method is only
available on functions of arity 2 and higher. Your case class only has
one parameter. Therefore, its auto-generated companion would not have
the "tupled" method either.
Kind regards
Andreas