Hyperlinkv0.8.0-beta.28

Filter

Filter.fromPredicateOptionconsteffect/Filter.ts:233
<A, B>(predicate: (a: A) => Option.Option<B>): Filter<A, B>

Creates a Filter from a function that returns an Option; Some(value) passes with value, and None fails with the original input.

constructors
Source effect/Filter.ts:2334 lines
export const fromPredicateOption = <A, B>(predicate: (a: A) => Option.Option<B>): Filter<A, B> => (input) => {
  const o = predicate(input)
  return o._tag === "None" ? Result.fail(input) : Result.succeed(o.value)
}