Given a structure where each property is of type These<E, A>
where E
and A
are different for each prop.
declare const someStruct: {
a1: TH.These<E1, A1>;
a2: TH.These<E2, A2>;
a3: TH.These<E3, A3>;
}
I'm treating These
like this
- left: critical error, computation failed
- right: successful computation
- both: minor error/warning, continue computation
Now I'm looking for a way to combine results of a struct like the one above
declare function merge(struct: Record<string, TH.These<unknown, unknown>>): E.Either<CriticalErrorLeftOnly, {
warnings: unknown[]; // these would be the E of Both
value: Record<string, unknown>;
}>
With an Either I could do sequenceS(E.Apply)(someStruct)
. But this would not work here, as it would also return a left for a both.