I'm a freshman in fp-ts, trying to understand how to compose together some things.
So, I have for example TaskEither, which are doing fetch and based on the result from a fetch I want to run another fetch or jump to next step, currently, I've done this in such way. Maybe someone knows a better way how to do this?
pipe(
tryCatch(
() => fetch('https://example.com'),
reason => String(reason)
),
chain(
d => d ?
tryCatch(
() => fetch('https://example.com'),
reason => String(reason)
) : right({})
),
chain(
finalResult => {
//console.log(finalResult)
return right(finalResult)
}
)
)
Thanks for reading:)