johnhungerford / generic-schema

2 stars 1 forks source link

Add Lazy support in Lens and ShapeIsomorphism #94

Closed johnhungerford closed 2 years ago

johnhungerford commented 2 years ago

In order for this to work, the shape of the outer schema will have to be cached for both A and B. Schemas for lazy fields will have to be extracted from the appropriate outer schema, rather than simply summoned. This is because the isomorphism is dependent on given schemas for both types, and there will be conflicts.

Similarly, to support lazy components due to nested recursive structures, where the lazy schema type is not the top level schema, we will need to change the implicit dependency from Schema[T] to SchemaProvider[T], so that it will extract from any given top-level schemas in scope that contain the required schema. (SchemaProvider includes SchemaExtractor as a lower priority source of schemas.)

johnhungerford commented 2 years ago

We ended up using the following to retrieve schemas:

given ...... (
   using
   outerSchema : Schema.Aux[OuterT, OuterTS],
   innerExtractor: SchemaExtractor.Aux[A, Schema.Aux[OuterT, OuterTS], AS],
   ...
)
johnhungerford commented 2 years ago

closed with #95