-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid going through the "tuple representation" #44
Comments
I have a bunch of vague ideas about this issue, I will try to see how far I can get. |
Writing down my main idea with the hope someone will be able to help me realising it. It is about avoiding going through the tuple representation of records and only for interpreting into a covariant target (you have to start somewhere ^^). lets take an example case class: final case class Foo(i: Int, s: String, b: Boolean) and a corresponding schema (isomorphisms eluded for brevity) val foo = record(
"i" -*>: prim(ScalaInt) :*:
"s" -*>: prim(ScalaString) :*:
"b" -*>: prim(ScalaBool)
) Which is a tree with this shape :
Since val curriedCtr: Int => String => Boolean => Foo = (Foo.apply _).curried Now, imagine we're able to carry some "context" along the traversal of our tree and that this context contains "some When reaching the After a few step we reach a first leaf (the We repeat the same mechanism when we reach the Finally, when we reach the last leaf and repeat the same operation again, we end up with an Traversing back up the two If you've read thus far, you probably agree that this sounds promising. With an But the problem is that the type of the said context would have to change during the traversal (from Moreover, we must make sure that every time we reach a leaf So far, I have no idea how to achieve that... |
This should be done after #38.
We should search for to avoid going through the "tuple representation" of records in the functors we derive.
Currently, when processing a record like:
The functors we derive from schemas first convert instances of
Foo
to a value of type(Int, (String, Boolean))
; there should be a way of expressing derivations that avoids this unnecessary step.Solving this issue might require to change the type of the
iso
field inUnion
andRecord
, currently anIso[A0, A]
.The text was updated successfully, but these errors were encountered: