Closed nevillelyh closed 4 years ago
Gen#{sized,resize}
to deal with stack overflow in recursive ADTs.
Cogen[A]
Arbitrary[B]
needed for deriving Arbitrary[A => B]
Erik's talkArbitrary[C[T]]
for container C
requires CanBuildFrom
which is not serializable. ScalaCheck has it's own but seems not comprehensive enough.Converter[T, R]
designExampleType
TableRowType
AvroType
AvroType
Diffy
ProtobufType
Basic requirements are done, closing.
Motivation
Right now we use a couple of shapeless based libraries in data pipelines.
GenericRecord
, BigQueryTableRow
, DatastoreEntity
, TensorFlowExample
RecordMapper
,RecordMatcher
,LenseMatcher
for some generic data type mapping/matching 1Gen[T]
random generators for tuples and case classesDiffy[T]
for comparing "diff" between 2 primitive types, case class, or Avro/Protobuf/BigQuery recordsSemigroup[T]
,Monoid[T]
for tuples & case classes 2The biggest problem of shapeless is slow compilation. Most of the type class derivation cases can be replaced with magnolia. We already have tfexample-derive for TF
Example
derivation. For 2, magnolia should be more flexible and maintainable than handcrafted macros.Not sure if 1 can be covered with magnolia but they're also not widely used.
Scopes
Converter[T]
for type conversion 33 may require a
core
sub-project. Another benefit of converters sharing a root trait is reusable tests, etc. but that's debatable.Tasks
A breakdown of tasks ranked by priority and size.
scalacheck
Gen[T]
derivationavro
/bigquery
/datastore
/tensorflow
/protobuf
Converter[T]
derivation, among themtensorflow
already exists,protobuf
might be doable but trickycats
Semigroup[T]
etc. derivation, since Algebird is not available for Scala 2.13 yetdiffy
Diffy[T]
derivation, with the goal of replacing that in ratatool