mapTuple3<A, B, C, R> function

Option<R> Function(Tuple3<Option<A>, Option<B>, Option<C>> tuple) mapTuple3<A, B, C, R>(
  1. R f(
    1. A a,
    2. B b,
    3. C c
    )
)

A variant of map3, that accepts the Option's as a Tuple3.

expect(
  tuple3(some(1), some(2), some(3)).chain(mapTuple3((a, b, c) => a + b + c)),
  some(6),
);
expect(
  tuple3(some(1), some(2), none()).chain(mapTuple3((a, b, c) => a + b + c)),
  none(),
);

Implementation

Option<R> Function(Tuple3<Option<A>, Option<B>, Option<C>> tuple)
    mapTuple3<A, B, C, R>(
  R Function(A a, B b, C c) f,
) =>
        (t) => map3(f)(t.first, t.second, t.third);