jmccance
06/05/2018, 8:50 PMx
and call copy
on x
, I expect to be able to call the same functions on the copy as I could on x
.”adam-mcneilly
06/05/2018, 9:02 PMadam-mcneilly
06/05/2018, 9:02 PMjmccance
06/05/2018, 9:03 PMAndreas Sinz
06/05/2018, 9:03 PMjmccance
06/05/2018, 9:04 PMAndreas Sinz
06/05/2018, 9:07 PMdata class Foo<A>(val bar: A, val baz: A)
val fooString = Foo("hello", "world")
val fooInt = fooString.copy(bar = 5) //Does it work? What is <A> afterwards?
adam-mcneilly
06/05/2018, 9:07 PMjmccance
06/05/2018, 9:08 PMjmccance
06/05/2018, 9:09 PMjmccance
06/05/2018, 9:09 PMscala> case class F[A](x: A, y: A)
defined class F
scala> val stringstringF = F("asdf", "zxcv")
stringstringF: F[String] = F(asdf,zxcv)
scala> val stringIntF = stringstringF.copy(x = 1)
stringIntF: F[Any] = F(1,zxcv)
jmccance
06/05/2018, 9:10 PMmadorb
06/05/2018, 9:36 PMcopy
to change
and 👍madorb
06/05/2018, 9:36 PMjmccance
06/05/2018, 9:40 PMmadorb
06/05/2018, 10:08 PMmadorb
06/05/2018, 10:08 PMgroovy
has some bizarre name for the operation