Hyperlinkv0.8.0-beta.28

Predicate

Predicate.eqvconsteffect/Predicate.ts:1687
<A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>
<A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>

Creates a predicate that returns true when both predicates agree.

When to use

Use when you want to check equivalence of two Predicates.

Details

Returns true when both results are equal.

Example (Defining equivalence)

import { Predicate } from "effect"

const isEven = (n: number) => n % 2 === 0
const same = Predicate.eqv(isEven, isEven)

console.log(same(3))
combinatorsxor
export const eqv: {
  <A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>
  <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>
} = dual(2, <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A> => (a) => self(a) === that(a))