const myProgramm4 = Effect.gen(function* (_) {
// since the new version of effect we can use yield* instead of yield* _()
const result = yield* Effect.succeed(10)
const result1 = yield* addOneE(result)
const result2 = yield* multiplyByTwoE(result1)
// Just imaging using yield* instead of await, you can do all the things you can do with async await but with the power of effect
const result3 = yield* Effect.promise(() =>
result2 < 10
? Promise.resolve(result2)
: Promise.reject(new Error('not lower than 10')),
)
return result3
})
Effect.runPromise(myProgramm4)
const myProgramm4 = Effect.gen(function* (_) {
// since the new version of effect we can use yield* instead of yield* _()
const result = yield* Effect.succeed(10)
const result1 = yield* addOneE(result)
const result2 = yield* multiplyByTwoE(result1)
// Just imaging using yield* instead of await, you can do all the things you can do with async await but with the power of effect
const result3 = yield* Effect.promise(() =>
result2 < 10
? Promise.resolve(result2)
: Promise.reject(new Error('not lower than 10')),
)
return result3
})
Effect.runPromise(myProgramm4)