import { option } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { traverse } = option;
Traverse over an Option using the supplied Applicable. This allows one to turn an Option into Kind<V, Option>.
Examples
Example 1
Example 1
import * as O from "./option.ts";
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const toRange = (n: number) => A.range(n);
const traverse = pipe(toRange, O.traverse(A.ApplicableArray));
const result1 = traverse(O.some(3)); // [Some(0), Some(1), Some(2)];
const result2 = traverse(O.none); // [None]
Parameters
A: Applicable<V>