Effect CommunityEC
Effect Community16mo ago
3 replies
Tom

How to short-circuit a pipeline using Option.none?

I am trying to make an effect which gets a resource from an HTTP endpoint. Successful status codes are 200 and 404. In the case of 404, I want to short-circuit a pipeline and return Option.none(). In the case of 200 I want to grab the JSON and decode it, then wrap it in Option.some(). I am getting myself confused with how to compose this, could somebody please offer an example? Thanks 🙂
Was this page helpful?