If I use partial application on a method (the apply()
method of my case class here), it works:
case class Foo(a : Int, b : Int)
val pf : Int => Foo = Foo(_ ,2)
However, it doesn't appear to be possible to use this in combination with named parameters, e.g. :
case class Foo(a : Int, b : Int)
val pf : Int => Foo = Foo(a = _ ,b = 2)
it results in :
Error:(7, 33) not found: value a
lazy val pf : Int => Foo = Foo(a = _ ,b = 2)
^
Is there any way around this? I need this because I have case classes with a large number of default parameters, that I don't want to have to specify most of the time.
(Scala 2.11)