Skip to content

andThenLens

andThenLens<A, B>(inner): <S>(outer) => Optional<S, B>

Defined in: Core/Optional.ts:215

Composes an Optional with a Lens, producing an Optional. The Lens focuses within the value found by the Optional.

A

B

Lens<A, B>

<S>(outer): Optional<S, B>

S

Optional<S, A>

Optional<S, B>

const cityOpt = pipe(
  Optional.prop<User>()("address"),
  Optional.andThenLens(Lens.prop<Address>()("city")),
);