目前我使用scalaz和shapeless生成一个仅更新更改值的case类,但是为了实现一些扩展功能,我需要知道哪些字段(名称)发生了更改,有没有简单的方法可以做到?
或者一般情况下是否有更好的方法检查每个字段的相等性?
示例:
case class A(quanity: Option[Long], lose: Option[Long])
val a0 = A(Option(50), Option(10))
val a1 = A(Option(50), Option(20))
// Here it will be merged to a2 which is done by scalaz
// Now I need the fields that changed, ie. quanity or lose
// (or any other field if there are more
// a list or anything would be good enough:
val mergedList: List[String] = "lose" :: List()