A purely-functional library for defining type-safe schemas for algebraic data types, providing free generators, SQL queries, JSON codecs, binary codecs, and migration from this schema definition
object PersonSchema extends Schema[Person] {
def apply(m: SchemaModule): m.Schema[A] = {
import m._
// Use everything in `m`
}
}
If now we had a way to abstract over the primitives required by a schema, it would then be possible to have polymorphic schemas (across, e.g., Scala, JSON, XML, etc.).
Since we are using
SchemaModule
, we may want to create a top-level, polymorphic definition of a schema. Something like this:Then a user can write:
If now we had a way to abstract over the primitives required by a schema, it would then be possible to have polymorphic schemas (across, e.g., Scala, JSON, XML, etc.).