NotRepresents a negative pattern matching case.
Details
A Not case contains the logic to test if a value does NOT match a specific
pattern and the function to evaluate when the pattern doesn't match. It's used
for exclusion-based pattern matching.
Example (Creating negative match cases)
import { Match } from "effect"
// Not creates cases that exclude specific patterns
const matcher = Match.type<string>().pipe(
// Match any string except "forbidden"
Match.not("forbidden", (s) => `Allowed: ${s}`),
Match.orElse(() => "This string is forbidden")
)
console.log(matcher("hello")) // "Allowed: hello"
console.log(matcher("forbidden")) // "This string is forbidden"models
Source effect/Match.ts:2315 lines
export interface Not {
readonly Not._tag: "Not"_tag: "Not"
Not.guard(u: unknown): booleanguard(u: unknownu: unknown): boolean
Not.evaluate(input: unknown): anyevaluate(input: unknowninput: unknown): any
}Referenced by 1 symbols