zio-schema
zio-schema copied to clipboard
Split Schema into covariant and contravariant parts
In some cases, it is enough to be able to tear down an A
into its pieces, or build an A
from its pieces, but the ability to do both is not needed, and imposing that ability onto a type leads to excessive pain for library authors.
To make this easier, we can have:
sealed trait SchemaDeconstruct[-A] {
// Contravariant part of `Schema`
}
sealed trait SchemaConstruct[+A] {
// Covariant part of `Schema`
}
final case class Schema[A](deconstruct: SchemaDeconstruct[A], construct: SchemaConstruct[A]) {
// Existing methods on Schema...
}
object Schema {
// Existing implicits for Schema...
implicit ...
}