Nested Effects (from promises)
Hi all
I am new to effect.ts and trying to figure out how to two possible paths following a promise in an idiomatic way. My goal would be to have a pipeline of first a fetch request and then split the result on the
This is my current draft, which does result in
Is there a eleganter way to achieve this? Or are there some helper functions in the library which unwrap this in the way I would like it? Thank you for any help or explanation.
I am new to effect.ts and trying to figure out how to two possible paths following a promise in an idiomatic way. My goal would be to have a pipeline of first a fetch request and then split the result on the
Response.ok boolean (true => Success; false => Failure). Then based on the outcome, I want the Response.json() in the success case, and the Response.text() in a failure case. I would expect it to have the type of Effect.Effect<unknown, string, never> at the end.This is my current draft, which does result in
Effect.Effect<Effect.Effect<unknown, never, never>, Effect.Effect<never, string, never>, never>:Is there a eleganter way to achieve this? Or are there some helper functions in the library which unwrap this in the way I would like it? Thank you for any help or explanation.
