Filtering Null Results from Organic Search Processing

What's the Effect idiomatic way here to kind of do a "reduce" of the results, removing the results from the forEach which are null? I tried fiddling with Effect.filter, but didn't get that working:
    const processOrganicResult = (result: Organic) => Effect.gen(function *($) {
      const html = yield $(zenrowsIdiomaticEffect(result.link))

      if (!html) {
        Console.log(`No html for ${result.title}`)
        return null
      }
      const markdown = extractMarkdown(result.link, html)

      if (!markdown) {
        Console.log(`No markdown for ${result.title}`)
        return null
      }

      return { url: result.link, title: result.title, markdown }
    })

    const allMarkdownResults = yield* $(Effect.forEach(allOrganicResults, processOrganicResult, {
      concurrency: 4,
    }))
    
    const markdownResults = allMarkdownResults.filter(Boolean) as {
      url: string
      title: string
      markdown: string
    }[]
Was this page helpful?