effect-io-ai

Package: effect
Module: Option

Option.partitionMap

Splits an Option into two Options based on the result of a mapping function that produces an Either.

Details

This function takes an Option and a mapping function f that converts its value into an Either. It returns a tuple of two Options:

If the input Option is None, both returned Options are None.

This utility is useful for filtering and categorizing the contents of an Option based on a bifurcating computation.

Signature

declare const partitionMap: { <A, B, C>(f: (a: A) => Either<C, B>): (self: Option<A>) => [left: Option<B>, right: Option<C>]; <A, B, C>(self: Option<A>, f: (a: A) => Either<C, B>): [left: Option<B>, right: Option<C>]; }

Source

Since v2.0.0