Handling Values or Effects Elegantly in Typescript with Effect Library

hi, is there any elegant way to handle this, where argument can be either the value or effect that resolves to that value on yield.
function parseStructuredContentFromResume() {
  return <E, R>(source: ResumeParserService | Effect.Effect<ResumeParserService, E, R>) =>
    Effect.gen(function* () {
      const resolvedSource = yield* pipe(source, resolveEffect<ResumeParserService, E, R>())
    })
}

here resolveEffect takes unknown value and wraps into effect based on its type.

so that, i could use pipes and make code look cleaner for example.
const source = yield* getResumeSource()
const content = yield* parseStructuredContentFromResume()(source)

instead of that, i could do something like
const content = yield* pipe(
  getResumeSource(),
  parseStructuredContentFromResume()
)
Was this page helpful?