How will typeclasses work with such unions? Based ...
# arrow
j
How will typeclasses work with such unions? Based on the name or based on representation? Or not at all?
r
Still unknown.
but typeclasses will support derivation of instances of products and coproducts when we get all this right
we are still exploring
Union is still an actual synthetic type so it can be the target of a type class if we modify the typeclass plugin to search for instances when it finds it in all their represented types instead of the package of Union
So you could potentially create an extension instance that targets a union of a certain shape
😍 1
j
I don't think by shape is a good idea, especially the either/validated part shows that. I think inline classes are worth exploring for that. You get unions at runtime and classes at compile time for typeclasses resolution. So that either becomes an inline class over a union and validated as well, same representation, maybe some magic in the union plugin to allow same expressivity but typeclasses by actual type instead of rep
👍 1