Leaf represents a single decode failure at some path in the input.
Composite aggregates child failures (one per failed field of an object,
one per failed element of a list, etc.) and mirrors the structural shape
of the input — making it possible to render user.name: expected string
alongside user.age: expected number from a single response.
Accumulation lives in the data, not in the wrapper. Combinators in
DecoderCompanion (object/list/map) produce Composite when more than
one child decoder fails, unwrapping single-child composites back to a
Leaf for cleaner error messages. The plain Either<DecoderError, A>
return type of Decoder<A> keeps composition with the rest of the
library uniform.
Named DecoderError (not DecodeError) to avoid collision with the
existing HttpError.DecodeError variant — these are at different layers:
the HTTP variant is the outer wrapper, this is the structural inner cause.
Recursive decoder error.
Leafrepresents a single decode failure at somepathin the input.Compositeaggregates child failures (one per failed field of an object, one per failed element of a list, etc.) and mirrors the structural shape of the input — making it possible to renderuser.name: expected stringalongsideuser.age: expected numberfrom a single response.Accumulation lives in the data, not in the wrapper. Combinators in
DecoderCompanion(object/list/map) produceCompositewhen more than one child decoder fails, unwrapping single-child composites back to aLeaffor cleaner error messages. The plainEither<DecoderError, A>return type ofDecoder<A>keeps composition with the rest of the library uniform.Named
DecoderError(notDecodeError) to avoid collision with the existingHttpError.DecodeErrorvariant — these are at different layers: the HTTP variant is the outer wrapper, this is the structural inner cause.