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
From the user's point of view, the most tedious part of defining a schema is writing the values of the iso field of unions and records.
For instance, in ordre to define the schema for a class
final case class Foo(i: Int, l: Long, s: String, b: Boolean)
one must implement an Iso[(Int, (Long, (String, (Boolean)))), Foo], which is 100% boilerplate.
Using generic programming, it is possible to derive automatically at compile time an Iso between any case class (product type) and its "nested tuples" representation. We should provide such a way in the generic module using scalaz-deriving.
This issue must be solved without modifying the existing API for building schemas (namely, the public methods in SchemaModule).
An acceptable solution would be to define some Generic* module extending SchemaModule with two methods :
caseClass* allowing to define a Record by simply providing a "product of labelled fields" (with automatic derivation of the iso)
sealedTrait* allowing to define an Union by simply providing a "sum of labelled branches (with automatic derivation of the iso)
Important note
This issue should be solved while taking into account the results of #44.
From the user's point of view, the most tedious part of defining a schema is writing the values of the
iso
field of unions and records.For instance, in ordre to define the schema for a class
one must implement an
Iso[(Int, (Long, (String, (Boolean)))), Foo]
, which is 100% boilerplate.Using generic programming, it is possible to derive automatically at compile time an
Iso
between any case class (product type) and its "nested tuples" representation. We should provide such a way in thegeneric
module usingscalaz-deriving
.This issue must be solved without modifying the existing API for building schemas (namely, the public methods in
SchemaModule
).An acceptable solution would be to define some
Generic
* module extendingSchemaModule
with two methods :caseClass
* allowing to define aRecord
by simply providing a "product of labelled fields" (with automatic derivation of theiso
)sealedTrait
* allowing to define anUnion
by simply providing a "sum of labelled branches (with automatic derivation of theiso
)Important note
This issue should be solved while taking into account the results of #44.
*: these names are merely suggested names