/** * Collects the first element of the `Collection( as: Collection, f: (a: A) => Effect> ): Effect> { return Effect.suspendSucceed(loop(as[Symbol.iterator](), f)) } function loop( iterator: Iterator, f: (a: A) => Effect> ): Effect> { const next = iterator.next() return next.done ? Effect.none : f(next.value).flatMap((option) => option.fold(loop(iterator, f), (b) => Effect.some(b))) }