effect-io-ai

Package: effect
Module: Option

Option.product

Combines two Options into a Some containing a tuple [A, B] if both are Some.

When to use

Use when you need to require two Option values to both be Some and keep both values as a tuple.

Details

Example (Pairing two Options)

import { Option } from "effect"

console.log(Option.product(Option.some("hello"), Option.some(42)))
// Output: { _id: 'Option', _tag: 'Some', value: ['hello', 42] }

console.log(Option.product(Option.none(), Option.some(42)))
// Output: { _id: 'Option', _tag: 'None' }

See

Signature

declare const product: <A, B>(self: Option<A>, that: Option<B>) => Option<[A, B]>

Source

Since v2.0.0