// ets_tracing: off import type { HashMap } from "@effect-ts/core" import { pipe } from "@effect-ts/core/Function" import type { Option } from "@effect-ts/core/Option" import * as _ from "../Internal/index.js" import type { Iso } from "../Iso/index.js" import type { Lens } from "../Lens/index.js" // ------------------------------------------------------------------------------------- // model // ------------------------------------------------------------------------------------- export interface At { readonly at: (i: I) => Lens } // ------------------------------------------------------------------------------------- // constructors // ------------------------------------------------------------------------------------- /** * Lift an instance of `At` using an `Iso` */ export const fromIso = (iso: Iso) => (sia: At): At => ({ at: (i) => pipe(iso, _.isoAsLens, _.lensComposeLens(sia.at(i))) }) export const atRecord: () => At< Readonly>, string, Option > = _.atRecord export const atHashMap: () => At< Readonly>, K, Option > = _.atHashMap