Fork me on GitHub
Ben Sless12:12:17

Thinking a bit about a workable composition of transformer and validator, will it be be correct to model it via a cps transform where validation is called after leave stage for each element? It is true that a schema could transform its children arbitrarily, so how could this be done in a single pass? Feels like trying to solve the halting problem


woudn't the validation be called a lot more that actually needed? e.g. leaf validates itself, one level up needs to re-validate the leaf as part of it's own validation, etc.

Ben Sless13:12:19

Ideally, no, you assume the leaves are already correct if you made it to the parent then you just satisfy the parent condition or combinator

Ben Sless13:12:28

Let's say that each coercer has a success or failure continuation. On failure, we just return, on success, we call the transformation and validation of the next value

Ben Sless13:12:38

Then you need to define the combination semantics for map, sequence, vector, tuple, and, or

Ben Sless13:12:07

Maybe the validation itself can be split to enter/leave

Ben Sless13:12:32

Map could check on enter that it's a map, then coerce its children

Ben Sless13:12:08

This holds as long as a transformer doesnt modify children recursively

Ben Sless13:12:57

Which is true for 99% of cases? So maybe there could be an optimistic coercer which isnt guaranteed to work all the time