// Psuedocode
const intensiveWork: (
key: string
) => Effect.Effect<never, never, string> => pipe(
if (isBaseCase(key)) {
return calculateValue(key); // synchronoush, not a lot of work
}
// Otherwise, recurse into a bunch of other cases
return pipe(
makeChildKeys(key), // choose all the cases to recurse into
childKey => intensiveWork(childKey), // do the recursion
ReadonlyArray.join(" "), // join all the results
);
);
// Psuedocode
const intensiveWork: (
key: string
) => Effect.Effect<never, never, string> => pipe(
if (isBaseCase(key)) {
return calculateValue(key); // synchronoush, not a lot of work
}
// Otherwise, recurse into a bunch of other cases
return pipe(
makeChildKeys(key), // choose all the cases to recurse into
childKey => intensiveWork(childKey), // do the recursion
ReadonlyArray.join(" "), // join all the results
);
);