The operation A.sequenceT allows to convert a sequence of typed Monads into a Monad of a typed tuple, such as in this Option example:
const sequenceO = A.sequenceT(O.Apply);
const o1: Option<number> = O.some(1);
const o2: Option<string> = O.some("1");
const o12: Option<[number, string]> = sequenceO(o1, o2);
what is the best representation of the inverse operation?
The best I could do as a special case for Option was:
const unsequenceO = O.fold<[number, string], [Option<number>, Option<string>]>(() => [O.none, O.none], ([s1, s2]) => [O.some(s1), O.some(s2)]);
const [u1, u2] = unsequenceO(o12);
but I wonder if there exists a concept (and more generic implementation) for this.