// this whole "helper" should have never appeared
// models tried to extract pieces of code
// to preserve imperative control flows
const loadNext = Effect.flatMap(loadNextContext, ({ state, token }) =>
Effect.map(
// it tried to use Option.toArray as "if" here :(
Effect.forEach(Option.toArray(token), loadNextPage),
// then it managed to insert another branching flow to check for Effect ran
(results) => Option.getOrElse(A.head(results), () => state),
),
);
// this whole "helper" should have never appeared
// models tried to extract pieces of code
// to preserve imperative control flows
const loadNext = Effect.flatMap(loadNextContext, ({ state, token }) =>
Effect.map(
// it tried to use Option.toArray as "if" here :(
Effect.forEach(Option.toArray(token), loadNextPage),
// then it managed to insert another branching flow to check for Effect ran
(results) => Option.getOrElse(A.head(results), () => state),
),
);