These are chat archives for typelevel/scala
Typelevel Scala compiler development and discussion | Latest release TLS 4 for 2.11.11, 2.12.3 and 2.13.0-M2 | Code of conduct http://typelevel.org/conduct.html
what's the best way of doing this:
i want to define a "timed" version for each case class that simply adds a field called
dateTime to it... do i need to pull out shapeless for this? (it does seem so because we will at the very least need to make sure that the case class doesn't already contain
Here's a naive solution that doesn't quite work:
case class Timed[A](a: A, dateTime: DateTime) implicit def taToA(ta: Timed[A]): A = ta.a case class A(value: Int) val ta = Timed(A(1), DateTime.now) assert(ta.value == 1)
Timedis a traversable functor which may come in handy.
B's and all sorts of case classes and I want to replace all of them with
Timed[B]s without having to rewrite all the
Timedwill definitely make the code cleaner, but I'll still have
maps everywhere. Not sure if that's clean enough!