Effect CommunityEC
Effect Community3y ago
25 replies
Peppineddu5

Converting Effect.gen to pipe

Hi, I'm new to Effect and I'm trying to convert this code from Effect.gen to pipe:
const program = Effect.gen(function * (_) {
  const fileSys: FS = yield * _(FS) // FS is a Context
  const text: string = yield * _(fileSys.readFileSync('../db/in.txt'))
  const result: boolean = yield * _(fileSys.writeFile('../db/out.txt', text))
  return yield * _(Console.log(String(result)))
})

The only way to solve this problem I think is to use a pipe grafted to another pipe, but that doesn't drive me crazy.
How would you convert it or what would you use?
Was this page helpful?