delta icon indicating copy to clipboard operation
delta copied to clipboard

Support labelled HList instance

Open stacycurl opened this issue 9 years ago • 1 comments

By moving the current instances into a hlist.unlabelled object and creating a hlist.labelled object.

See https://github.com/milessabin/shapeless/blob/master/examples/src/main/scala/shapeless/examples/sexp.scala for an example a hlist instance that uses labels.

stacycurl avatar Apr 14 '15 10:04 stacycurl

Not sure if this is what you mean but we'd want to know the field name which is different and probably the nested classes.

case class Customer(address: Address)
case class Address(line1: String, zip: Zip)
case class Zip(zip: Int, plusFour: Option[Int])

So if zipPlusFour was changed we'd want a label like Customer.Address.Zip.plusFour along with the change type:

sealed trait ChangeType
final case class Added[T](newValue: T) extends ChangeType // eg 1234
final case class Updated[T](originalValue: T, updatedValue: T) extends ChangeType //eg 1234, 2345
final case class Removed[T](deletedValue: T) extends ChangeType // eg 2345 

BusyByte avatar Dec 22 '16 15:12 BusyByte