-
Let's say I have an array of TaskEither but I want to run all of them regardless of failure. What's the best way to achieve that with fp-ts? I came up with the following:
This gets me the desired |
Beta Was this translation helpful? Give feedback.
Answered by
0x706b
Jun 24, 2022
Replies: 1 comment 1 reply
-
You could use import { pipe, identity } from 'fp-ts/function'
import * as T from 'fp-ts/Task'
import * as TE from 'fp-ts/TaskEither'
import * as RA from 'fp-ts/ReadonlyArray'
declare const effects: ReadonlyArray<TE.TaskEither<Error, string>>
pipe(
effects,
RA.wilt(T.ApplicativePar)(identity),
) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
evelant
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use
wilt
from theWitherable
typeclass (basically an effectfulpartitionMap
):