case class copy 'method' with superclass

后端 未结 7 2013
误落风尘
误落风尘 2020-12-05 07:16

I want to do something like this:

sealed abstract class Base(val myparam:String)

case class Foo(override val mypar         


        
7条回答
  •  我在风中等你
    2020-12-05 07:38

    There is a very comprehensive explanation of how to do this using shapeless at http://www.cakesolutions.net/teamblogs/copying-sealed-trait-instances-a-journey-through-generic-programming-and-shapeless ; in case the link breaks, the approach uses the copySyntax utilities from shapeless, which should be sufficient to find more details.

提交回复
热议问题