(), O.props("title", "description"));
*
* const suttree: Book = {
* title: "Suttree",
* description: "Cormac on Cormac",
* authors: ["Cormac McCarthy"],
* published: new Date("May 01 1979"),
* };
*
* const result1 = pipe(short, O.view(suttree));
* // { title: "Suttree", description: "Cormac on Cormac" }
* ```
*
* @since 2.0.0
*/
export declare function props, P extends keyof A>(...props: [P, P, ...Array]): (first: Optic) => Optic, S, {
[K in P]: A[K];
}>;
/**
* A composible combinator that focuses on a value in an array at the given
* index.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const second = pipe(
* O.id>(),
* O.index(1),
* );
*
* const result1 = pipe(second, O.view([])); // None
* const result2 = pipe(second, O.view(["Hello", "World"])); // Some("World")
* ```
*
* @since 2.0.0
*/
export declare function index(index: number): (first: Optic>) => Optic, S, A>;
/**
* A composible combinator that focuses on a key in a readonly record.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const one = pipe(
* O.id>>(),
* O.key("one"),
* );
*
* const result1 = pipe(one, O.view({})); // None
* const result2 = pipe(one, O.view({ one: "one" })); // Some("one")
* ```
*
* @since 2.0.0
*/
export declare function key(key: string): (first: Optic>) => Optic, S, A>;
/**
* A composible combinator that focuses on a key in a readonly record. The
* difference between atKey and key is that the key can be removed from the
* record by the modify function if the modify function returns None.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { constNone } from "./option.ts";
* import { pipe } from "./fn.ts";
*
* const atOne = pipe(
* O.id>>(),
* O.atKey("one"),
* );
* const removeAtOne = pipe(atOne, O.replace(constNone()));
*
* const result1 = pipe(atOne, O.view({})); // None
* const result2 = pipe(atOne, O.view({ one: "one" })); // Some("one")
* const result3 = removeAtOne({}); // {}
* const result4 = removeAtOne({ one: "one" }); // {}
* const result5 = removeAtOne({ one: "one", two: "two" }); // { two: "two" }
* ```
*
* @since 2.0.0
*/
export declare function atKey(key: string): (first: Optic>>) => Optic, S, Option>;
/**
* A composible combinator that can filter or refine the focused value of an
* existing optic. Care should be taken with this operator as it apples to the
* modify function as well as the view function. That is to say that if the
* refinement or predicate returns false for the focused value then that value
* will not be modified. See the example for clarification.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const positive = pipe(O.id(), O.filter(n => n > 0));
*
* const result1 = pipe(positive, O.view(1)); // Some(1);
* const result2 = pipe(positive, O.view(0)); // None
* const result3 = pipe(1, positive.modify(n => n + 1)); // 2
* const result4 = pipe(0, positive.modify(n => n + 1)); // 0
* ```
*
* @since 2.0.0
*/
export declare function filter(r: Refinement): (first: Optic) => Optic, S, B>;
export declare function filter(r: Predicate): (first: Optic) => Optic, S, A>;
/**
* Construct a composable combinator from an instance of Comparable and a key of a map.
* The combinator can then be composed with an existing optic to access or
* remove the value in the map.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import * as M from "./map.ts";
* import { ComparableString, toLowerCase } from "./string.ts";
* import { premap } from "./comparable.ts";
* import { constNone } from "./option.ts";
* import { pipe } from "./fn.ts";
*
* type Words = ReadonlyMap;
*
* const insensitive = pipe(ComparableString, premap(toLowerCase));
*
* const fun = pipe(O.id(), O.atMap(insensitive)("fun"));
* const remove = pipe(fun, O.replace(constNone()));
*
* const result1 = pipe(fun, O.view(new Map([["FUN", 100]]))); // Some(100)
* const result2 = pipe(fun, O.view(M.init())); // None
* const result3 = remove(new Map([["FUN", 100], ["not", 10]]));
* // Map("not": 10);
* ```
*
* @since 2.0.0
*/
export declare function atMap(eq: Comparable): (key: B) => (first: Optic>) => Optic, S, Option>;
/**
* Construct a composable optic from a Traversable instance for a Kind T. This
* will fold the values wrapped in the Kind T into a single Array when viewed.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import * as T from "./tree.ts";
* import { pipe } from "./fn.ts";
*
* type Data = { tree: T.Tree };
*
* const numbers = pipe(
* O.id(),
* O.prop("tree"),
* O.traverse(T.TraversableTree),
* );
*
* const tree1: Data = { tree: T.tree(1, [T.tree(2), T.tree(3)]) };
* const tree2: Data = { tree: T.tree(0) };
*
* const result1 = pipe(numbers, O.view(tree1)); // [1, 2, 3]
* const result2 = pipe(numbers, O.view(tree2)); // [0]
* const result3 = pipe(tree1, numbers.modify(n => n + 1));
* // Tree(2, [Tree(3), Tree(4)])
* ```
*
* @since 2.0.0
*/
export declare function traverse(T: Traversable): (first: Optic>) => Optic, S, A>;
/**
* Given a Combinable and a function A -> I, collect all values A focused on by an
* optic into a single value I.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { InitializableNumberSum } from "./number.ts";
* import { pipe, identity } from "./fn.ts";
*
* type Person = { name: string, age: number };
* type People = readonly Person[];
*
* const cumulativeAge = pipe(
* O.id(),
* O.array,
* O.prop("age"),
* O.combineAll(InitializableNumberSum, identity),
* );
*
* const people: People = [
* { name: "Brandon", age: 37 },
* { name: "Emily", age: 22 },
* { name: "Jackie", age: 47 },
* { name: "Rufus", age: 1 },
* ];
*
* const result1 = cumulativeAge(people); // 107
* const result2 = cumulativeAge([]); // 0
* ```
*
* @since 2.0.0
*/
export declare function combineAll(initializable: Initializable, fai: (a: A) => I): (first: Optic) => (s: S) => I;
/**
* A preconstructed traversal that focuses the values of a ReadonlyRecord.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const result = pipe(
* O.id>>(),
* O.record,
* O.view({ one: 1, two: 2 }),
* ); // [1, 2]
* ```
*
* @since 2.0.0
*/
export declare const record: (first: Optic>) => Optic, S, A>;
/**
* A preconstructed traversal that focuses the values of a ReadonlyArray.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const result = pipe(
* O.id>(),
* O.array,
* O.filter(n => n % 2 === 0),
* O.view([1, 2, 3]),
* ); // [2]
* ```
*
* @since 2.0.0
*/
export declare const array: (first: Optic>) => Optic, S, A>;
/**
* A preconstructed traversal that focuses the values of a ReadonlySet.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { pipe } from "./fn.ts";
*
* const result = pipe(
* O.id>(),
* O.set,
* O.view(new Set([1, 2, 3])),
* ); // [1, 2, 3]
* ```
*
* @since 2.0.0
*/
export declare const set: (first: Optic>) => Optic, S, A>;
/**
* A preconstructed traversal that focuses the values of a Tree.
*
* @example
* ```ts
* import type { Tree } from "./tree.ts";
* import * as O from "./optic.ts";
* import * as T from "./tree.ts";
* import { pipe } from "./fn.ts";
*
* const result = pipe(
* O.id>(),
* O.tree,
* O.view(T.tree(1, [T.tree(2, [T.tree(3)])])),
* ); // [1, 2, 3]
* ```
*
* @since 2.0.0
*/
export declare const tree: (first: Optic>) => Optic, S, A>;
/**
* A preconstructed filter that focuses on the the non-null and non-undefined
* value of A | null | undefined.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { constNone } from "./option.ts";
* import { pipe } from "./fn.ts";
*
* type Input = { value?: string | null };
*
* const value = pipe(O.id(), O.prop("value"), O.nil);
*
* const result1 = pipe(value, O.view({})); // None
* const result2 = pipe(value, O.view({ value: "Hello" })); // Some("Hello")
* ```
*
* @since 2.0.0
*/
export declare const nil: (first: Optic) => Optic, S, NonNullable>;
/**
* A preconstructed composed prism that focuses on the Some value of an Option.
*
* @example
* ```ts
* import * as O from "./optic.ts";
* import { Option, some, none } from "./option.ts";
* import { pipe } from "./fn.ts";
*
* type Person = { name: string, talent: Option };
* type People = readonly Person[]
*
* const talent = pipe(O.id(), O.array, O.prop("talent"), O.some);
*
* const brandon: Person = { name: "Brandon", talent: none };
* const emily: Person = { name: "Emily", talent: some("Knitting") };
*
* const result = pipe(talent, O.view([brandon, emily])); // ["Knitting"];
* ```
*
* @since 2.0.0
*/
export declare const some: