traverse<A, B> function

Option<IList<B>> Function(Iterable<A>) traverse<A, B>(
  1. Option<B> f(
    1. A a
    )
)

Implementation

Option<IList<B>> Function(Iterable<A>) traverse<A, B>(
  Option<B> Function(A a) f,
) =>
    (as) => as.fold(
          some(IList()),
          (acc, a) => acc._fold(
            none,
            (bs) => f(a)._fold(
              none,
              (b) => some(bs.add(b)),
            ),
          ),
        );