map3K<A, B, C, R> function

Option<R> Function(Option<A> optionA) map3K<A, B, C, R>(
  1. Option<B> optionB,
  2. Option<C> optionC,
  3. R f(
    1. A a,
    2. B b,
    3. C c
    )
)

A wrapper around map3, useful for chaining. The remaining Option's are passed as arguments.

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

Implementation

Option<R> Function(Option<A> optionA) map3K<A, B, C, R>(
  Option<B> optionB,
  Option<C> optionC,
  R Function(A a, B b, C c) f,
) =>
    (optionA) => map3(f)(optionA, optionB, optionC);