Package: effect
Module: Optic
Prism that focuses on Option.None, exposing undefined.
When to use
Use when you want to match or construct None values within an optic chain.
Details
getResult succeeds with undefined when the option is None.getResult fails when the option is Some.set(undefined) produces Option.none().Example (Matching None)
import { Optic, Option, Result } from "effect"
const _none = Optic.id<Option.Option<number>>().compose(Optic.none())
console.log(Result.isSuccess(_none.getResult(Option.none())))
// Output: true
console.log(Result.isFailure(_none.getResult(Option.some(1))))
// Output: true
See
some — focuses on Some insteadPrism — the type this function returnsSignature
declare const none: <A>() => Prism<Option.Option<A>, undefined>
Since v4.0.0