effect-io-ai

Package: effect
Module: Optic

Optic.id

Iso that focuses on the whole value unchanged.

When to use

Use when you need to start an optic chain with a focus on the whole value.

Details

Example (Starting an optic chain)

import { Optic } from "effect"

type S = { readonly x: number }

const _x = Optic.id<S>().key("x")

console.log(_x.get({ x: 42 }))
// Output: 42

See

Signature

declare const id: <S>() => Iso<S, S>

Source

Since v4.0.0