Hello, I am new to Effect but come from a little Haskell experience. I know that Option is also an Effect, but I am unsure how to concisely turn a None value into an effect. Is there a more concise way to achieve this?
const x = yield* Option.match(item, { onNone: () => Effect.fail("There was nothing"), onSome: x => Effect.succeed(x), })
const x = yield* Option.match(item, { onNone: () => Effect.fail("There was nothing"), onSome: x => Effect.succeed(x), })
Just in case I am asking an X Y problem, this was the 2nd iteration of something that looked more like this:
if (Option.isNone(item) return Effect.fail("There was nothing")const x = yield* item
if (Option.isNone(item) return Effect.fail("There was nothing")const x = yield* item
Which felt dirty and unintuitive since the
yield* item
yield* item
would not fail even though the syntax suggests it might short-circuit.