The Rule of Schemas from
@effect/schema docs:
“…when you perform both encoding and decoding operations,
you should end up with the original value.”
The reason we test both ways, I.e.: encode ∘ decode = identityanddecode ∘ encode = identity is there are fault models that would be
entirely ignored if we only tested one direction. Check the
schema laws self-test
for one such example.
The Rule of Schemas from @effect/schema docs: “…when you perform both encoding and decoding operations, you should end up with the original value.”
The reason we test both ways, I.e.:
encode ∘ decode = identity
anddecode ∘ encode = identity
is there are fault models that would be entirely ignored if we only tested one direction. Check the schema laws self-test for one such example.