Package: effect
Module: Predicate
Creates a predicate that returns true if exactly one predicate is true.
When to use
Use when you want to combine two Predicates with exclusive-or semantics.
Details
Returns true when results differ.
Example (Checking exclusive-or conditions)
import { Predicate } from "effect"
const isEven = (n: number) => n % 2 === 0
const isPositive = (n: number) => n > 0
const either = Predicate.xor(isEven, isPositive)
console.log(either(-2))
See
orandSignature
declare const xor: { <A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>; <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>; }
Since v2.0.0