effect-io-ai

Package: effect
Module: Filter

Filter.andRight

Combines two filters but only returns the result of the right filter.

Example (Keeping the right filter result)

import { Filter, Result } from "effect"

const positiveNumbers = Filter.fromPredicate((n: number) => n > 0)
const doubleNumbers = Filter.make((n: number) =>
  n > 0 ? Result.succeed(n * 2) : Result.fail(n)
)

const positiveDoubled = Filter.andRight(positiveNumbers, doubleNumbers)

Signature

declare const andRight: { <InputR, PassR, FailR>(right: Filter<InputR, PassR, FailR>): <InputL, PassL, FailL>(left: Filter<InputL, PassL, FailL>) => Filter<InputL & InputR, PassR, FailL | FailR>; <InputL, PassL, FailL, InputR, PassR, FailR>(left: Filter<InputL, PassL, FailL>, right: Filter<InputR, PassR, FailR>): Filter<InputL & InputR, PassR, FailL | FailR>; }

Source

Since v4.0.0