monocle-ts

  • Version 2.3.13
  • Published
  • 368 kB
  • No dependencies
  • MIT license

Install

npm i monocle-ts
yarn add monocle-ts
pnpm add monocle-ts

Overview

A porting of scala monocle library to TypeScript

Index

Functions

Classes

Interfaces

Type Aliases

Namespaces

Functions

function fromFoldable

fromFoldable: {
<F extends URIS3>(F: Foldable3<F>): <U, L, A>() => Fold<Kind3<F, U, L, A>, A>;
<F extends URIS2>(F: Foldable2<F>): <L, A>() => Fold<Kind2<F, L, A>, A>;
<F extends URIS>(F: Foldable1<F>): <A>() => Fold<Kind<F, A>, A>;
<F>(F: Foldable<F>): <A>() => Fold<HKT<F, A>, A>;
};
  • Create a Fold from a Foldable

    constructor 1.0.0

function fromTraversable

fromTraversable: {
<T extends URIS3>(T: Traversable3<T>): <U, L, A>() => Traversal<
Kind3<T, U, L, A>,
A
>;
<T extends URIS2>(T: Traversable2<T>): <L, A>() => Traversal<Kind2<T, L, A>, A>;
<T extends URIS>(T: Traversable1<T>): <A>() => Traversal<Kind<T, A>, A>;
<T>(T: Traversable<T>): <A>() => Traversal<HKT<T, A>, A>;
};
  • Create a Traversal from a Traversable

    Example 1

    import { Lens, fromTraversable } from 'monocle-ts' import { Traversable } from 'fp-ts/Array'

    interface Tweet { text: string }

    interface Tweets { tweets: Tweet[] }

    const tweetsLens = Lens.fromProp()('tweets') const tweetTextLens = Lens.fromProp()('text') const tweetTraversal = fromTraversable(Traversable)() const composedTraversal = tweetsLens.composeTraversal(tweetTraversal).composeLens(tweetTextLens)

    const tweet1: Tweet = { text: 'hello world' } const tweet2: Tweet = { text: 'foobar' } const model: Tweets = { tweets: [tweet1, tweet2] }

    const actual = composedTraversal.modify(text => text .split('') .reverse() .join('') )(model)

    assert.deepStrictEqual(actual, { tweets: [ { text: 'dlrow olleh' }, { text: 'raboof' } ] })

    constructor 1.0.0

Classes

class At

class At<S, I, A> {}
  • constructor 1.2.0

constructor

constructor(at: (i: I) => Lens<S, A>);

    property at

    readonly at: (i: I) => Lens<S, A>;

      method fromIso

      fromIso: <T>(iso: Iso<T, S>) => At<T, I, A>;
      • lift an instance of At using an Iso

        1.2.0

      class Fold

      class Fold<S, A> {}
      • constructor 1.0.0

      constructor

      constructor(foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M);

        property all

        readonly all: (p: Predicate<A>) => Predicate<S>;
        • check if all targets satisfy the predicate

          1.0.0

        property exist

        readonly exist: (p: Predicate<A>) => Predicate<S>;
        • check if at least one target satisfies the predicate

          1.0.0

        property foldMap

        readonly foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M;

          property getAll

          readonly getAll: (s: S) => Array<A>;
          • get all the targets of a Fold

            1.0.0

          method compose

          compose: <B>(ab: Fold<A, B>) => Fold<S, B>;
          • compose a Fold with a Fold

            1.0.0

          method composeFold

          composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
          • Alias of compose

            1.0.0

          method composeGetter

          composeGetter: <B>(ab: Getter<A, B>) => Fold<S, B>;
          • compose a Fold with a Getter

            1.0.0

          method composeIso

          composeIso: <B>(ab: Iso<A, B>) => Fold<S, B>;
          • compose a Fold with a Iso

            1.0.0

          method composeLens

          composeLens: <B>(ab: Lens<A, B>) => Fold<S, B>;
          • compose a Fold with a Lens

            1.0.0

          method composeOptional

          composeOptional: <B>(ab: Optional<A, B>) => Fold<S, B>;
          • compose a Fold with a Optional

            1.0.0

          method composePrism

          composePrism: <B>(ab: Prism<A, B>) => Fold<S, B>;
          • compose a Fold with a Prism

            1.0.0

          method composeTraversal

          composeTraversal: <B>(ab: Traversal<A, B>) => Fold<S, B>;
          • compose a Fold with a Traversal

            1.0.0

          method find

          find: {
          <B extends A>(p: Refinement<A, B>): (s: S) => Option<B>;
          (p: Predicate<A>): (s: S) => Option<A>;
          };
          • find the first target of a Fold matching the predicate

            1.0.0

          method headOption

          headOption: (s: S) => Option<A>;
          • get the first target of a Fold

            1.0.0

          class Getter

          class Getter<S, A> {}
          • constructor 1.0.0

          constructor

          constructor(get: (s: S) => A);

            property get

            readonly get: (s: S) => A;

              method asFold

              asFold: () => Fold<S, A>;
              • view a Getter as a Fold

                1.0.0

              method compose

              compose: <B>(ab: Getter<A, B>) => Getter<S, B>;
              • compose a Getter with a Getter

                1.0.0

              method composeFold

              composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
              • compose a Getter with a Fold

                1.0.0

              method composeGetter

              composeGetter: <B>(ab: Getter<A, B>) => Getter<S, B>;
              • Alias of compose

                1.0.0

              method composeIso

              composeIso: <B>(ab: Iso<A, B>) => Getter<S, B>;
              • compose a Getter with a Iso

                1.0.0

              method composeLens

              composeLens: <B>(ab: Lens<A, B>) => Getter<S, B>;
              • compose a Getter with a Lens

                1.0.0

              method composeOptional

              composeOptional: <B>(ab: Optional<A, B>) => Fold<S, B>;
              • compose a Getter with a Optional

                1.0.0

              method composePrism

              composePrism: <B>(ab: Prism<A, B>) => Fold<S, B>;
              • compose a Getter with a Prism

                1.0.0

              method composeTraversal

              composeTraversal: <B>(ab: Traversal<A, B>) => Fold<S, B>;
              • compose a Getter with a Optional

                1.0.0

              class Index

              class Index<S, I, A> {}
              • constructor 1.2.0

              constructor

              constructor(index: (i: I) => Optional<S, A>);

                property index

                readonly index: (i: I) => Optional<S, A>;

                  method fromAt

                  static fromAt: <T, J, B>(at: At<T, J, Option<B>>) => Index<T, J, B>;
                  • 1.2.0

                  method fromIso

                  fromIso: <T>(iso: Iso<T, S>) => Index<T, I, A>;
                  • lift an instance of Index using an Iso

                    1.2.0

                  class Iso

                  class Iso<S, A> {}
                  • Laws: 1. reverseGet(get(s)) = s 2. get(reversetGet(a)) = a

                    constructor 1.0.0

                  constructor

                  constructor(get: (s: S) => A, reverseGet: (a: A) => S);

                    property from

                    readonly from: (a: A) => S;
                    • 1.0.0

                    property get

                    readonly get: (s: S) => A;

                      property reverseGet

                      readonly reverseGet: (a: A) => S;

                        property to

                        readonly to: (s: S) => A;
                        • 1.0.0

                        property unwrap

                        readonly unwrap: (s: S) => A;
                        • 1.0.0

                        property wrap

                        readonly wrap: (a: A) => S;
                        • 1.0.0

                        method asFold

                        asFold: () => Fold<S, A>;
                        • view an Iso as a Fold

                          1.0.0

                        method asGetter

                        asGetter: () => Getter<S, A>;
                        • view an Iso as a Getter

                          1.0.0

                        method asLens

                        asLens: () => Lens<S, A>;
                        • view an Iso as a Lens

                          1.0.0

                        method asOptional

                        asOptional: () => Optional<S, A>;
                        • view an Iso as a Optional

                          1.0.0

                        method asPrism

                        asPrism: () => Prism<S, A>;
                        • view an Iso as a Prism

                          1.0.0

                        method asSetter

                        asSetter: () => Setter<S, A>;
                        • view an Iso as a Setter

                          1.0.0

                        method asTraversal

                        asTraversal: () => Traversal<S, A>;
                        • view an Iso as a Traversal

                          1.0.0

                        method compose

                        compose: <B>(ab: Iso<A, B>) => Iso<S, B>;
                        • compose an Iso with an Iso

                          1.0.0

                        method composeFold

                        composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
                        • compose an Iso with a Fold

                          1.0.0

                        method composeGetter

                        composeGetter: <B>(ab: Getter<A, B>) => Getter<S, B>;
                        • compose an Iso with a Getter

                          1.0.0

                        method composeIso

                        composeIso: <B>(ab: Iso<A, B>) => Iso<S, B>;
                        • Alias of compose

                          1.0.0

                        method composeLens

                        composeLens: <B>(ab: Lens<A, B>) => Lens<S, B>;
                        • compose an Iso with a Lens

                          1.0.0

                        method composeOptional

                        composeOptional: <B>(ab: Optional<A, B>) => Optional<S, B>;
                        • compose an Iso with an Optional

                          1.0.0

                        method composePrism

                        composePrism: <B>(ab: Prism<A, B>) => Prism<S, B>;
                        • compose an Iso with a Prism

                          1.0.0

                        method composeSetter

                        composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                        • compose an Iso with a Setter

                          1.0.0

                        method composeTraversal

                        composeTraversal: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                        • compose an Iso with a Traversal

                          1.0.0

                        method modify

                        modify: (f: (a: A) => A) => (s: S) => S;
                        • 1.0.0

                        method reverse

                        reverse: () => Iso<A, S>;
                        • reverse the Iso: the source becomes the target and the target becomes the source 1.0.0

                        class Lens

                        class Lens<S, A> {}
                        • Laws: 1. get(set(a)(s)) = a 2. set(get(s))(s) = s 3. set(a)(set(a)(s)) = set(a)(s)

                          constructor 1.0.0

                        constructor

                        constructor(get: (s: S) => A, set: (a: A) => (s: S) => S);

                          property get

                          readonly get: (s: S) => A;

                            property set

                            readonly set: (a: A) => (s: S) => S;

                              method asFold

                              asFold: () => Fold<S, A>;
                              • view a Lens as a Fold

                                1.0.0

                              method asGetter

                              asGetter: () => Getter<S, A>;
                              • view a Lens as a Getter

                                1.0.0

                              method asOptional

                              asOptional: () => Optional<S, A>;
                              • view a Lens as a Optional

                                1.0.0

                              method asSetter

                              asSetter: () => Setter<S, A>;
                              • view a Lens as a Setter

                                1.0.0

                              method asTraversal

                              asTraversal: () => Traversal<S, A>;
                              • view a Lens as a Traversal

                                1.0.0

                              method compose

                              compose: <B>(ab: Lens<A, B>) => Lens<S, B>;
                              • compose a Lens with a Lens

                                1.0.0

                              method composeFold

                              composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
                              • compose a Lens with a Fold

                                1.0.0

                              method composeGetter

                              composeGetter: <B>(ab: Getter<A, B>) => Getter<S, B>;
                              • compose a Lens with a Getter

                                1.0.0

                              method composeIso

                              composeIso: <B>(ab: Iso<A, B>) => Lens<S, B>;
                              • compose a Lens with an Iso

                                1.0.0

                              method composeLens

                              composeLens: <B>(ab: Lens<A, B>) => Lens<S, B>;
                              • Alias of compose

                                1.0.0

                              method composeOptional

                              composeOptional: <B>(ab: Optional<A, B>) => Optional<S, B>;
                              • compose a Lens with an Optional

                                1.0.0

                              method composePrism

                              composePrism: <B>(ab: Prism<A, B>) => Optional<S, B>;
                              • compose a Lens with a Prism

                                1.0.0

                              method composeSetter

                              composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                              • compose a Lens with an Setter

                                1.0.0

                              method composeTraversal

                              composeTraversal: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                              • compose a Lens with an Traversal

                                1.0.0

                              method fromNullableProp

                              static fromNullableProp: <S>() => <A extends S[K], K extends keyof S>(
                              k: K,
                              defaultValue: A
                              ) => Lens<S, NonNullable<S[K]>>;
                              • Returns a Lens from a nullable (A | null | undefined) prop

                                Example 1

                                import { Lens } from 'monocle-ts'

                                interface Outer { inner?: Inner }

                                interface Inner { value: number foo: string }

                                const inner = Lens.fromNullableProp()('inner', { value: 0, foo: 'foo' }) const value = Lens.fromProp()('value') const lens = inner.compose(value)

                                assert.deepStrictEqual(lens.set(1)({}), { inner: { value: 1, foo: 'foo' } }) assert.strictEqual(lens.get({}), 0) assert.deepStrictEqual(lens.set(1)({ inner: { value: 1, foo: 'bar' } }), { inner: { value: 1, foo: 'bar' } }) assert.strictEqual(lens.get({ inner: { value: 1, foo: 'bar' } }), 1)

                                1.0.0

                              method fromPath

                              static fromPath: <S>() => LensFromPath<S>;
                              • Example 1

                                import { Lens } from 'monocle-ts'

                                type Person = { name: string age: number address: { city: string } }

                                const city = Lens.fromPath()(['address', 'city'])

                                const person: Person = { name: 'Giulio', age: 43, address: { city: 'Milan' } }

                                assert.strictEqual(city.get(person), 'Milan') assert.deepStrictEqual(city.set('London')(person), { name: 'Giulio', age: 43, address: { city: 'London' } })

                                1.0.0

                              method fromProp

                              static fromProp: <S>() => <P extends keyof S>(prop: P) => Lens<S, S[P]>;
                              • Returns a Lens from a type and a prop

                                Example 1

                                import { Lens } from 'monocle-ts'

                                type Person = { name: string age: number }

                                const age = Lens.fromProp()('age')

                                const person: Person = { name: 'Giulio', age: 43 }

                                assert.strictEqual(age.get(person), 43) assert.deepStrictEqual(age.set(44)(person), { name: 'Giulio', age: 44 })

                                1.0.0

                              method fromProps

                              static fromProps: <S>() => <P extends keyof S>(
                              props: P[]
                              ) => Lens<S, { [K in P]: S[K] }>;
                              • Returns a Lens from a type and an array of props

                                Example 1

                                import { Lens } from 'monocle-ts'

                                interface Person { name: string age: number rememberMe: boolean }

                                const lens = Lens.fromProps()(['name', 'age'])

                                const person: Person = { name: 'Giulio', age: 44, rememberMe: true }

                                assert.deepStrictEqual(lens.get(person), { name: 'Giulio', age: 44 }) assert.deepStrictEqual(lens.set({ name: 'Guido', age: 47 })(person), { name: 'Guido', age: 47, rememberMe: true })

                                1.0.0

                              method modify

                              modify: (f: (a: A) => A) => (s: S) => S;
                              • 1.0.0

                              class Optional

                              class Optional<S, A> {}
                              • Laws: 1. pipe(getOption(s), fold(() => s, a => set(a)(s))) = s 2. getOption(set(a)(s)) = pipe(getOption(s), map(_ => a)) 3. set(a)(set(a)(s)) = set(a)(s)

                                constructor 1.0.0

                              constructor

                              constructor(getOption: (s: S) => Option<A>, set: (a: A) => (s: S) => S);

                                property getOption

                                readonly getOption: (s: S) => Option<A>;

                                  property set

                                  readonly set: (a: A) => (s: S) => S;

                                    method asFold

                                    asFold: () => Fold<S, A>;
                                    • view an Optional as a Fold

                                      1.0.0

                                    method asSetter

                                    asSetter: () => Setter<S, A>;
                                    • view an Optional as a Setter

                                      1.0.0

                                    method asTraversal

                                    asTraversal: () => Traversal<S, A>;
                                    • view a Optional as a Traversal

                                      1.0.0

                                    method compose

                                    compose: <B>(ab: Optional<A, B>) => Optional<S, B>;
                                    • compose a Optional with a Optional

                                      1.0.0

                                    method composeFold

                                    composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
                                    • compose an Optional with a Fold

                                      1.0.0

                                    method composeGetter

                                    composeGetter: <B>(ab: Getter<A, B>) => Fold<S, B>;
                                    • compose an Optional with a Getter

                                      1.0.0

                                    method composeIso

                                    composeIso: <B>(ab: Iso<A, B>) => Optional<S, B>;
                                    • compose an Optional with a Iso

                                      1.0.0

                                    method composeLens

                                    composeLens: <B>(ab: Lens<A, B>) => Optional<S, B>;
                                    • compose an Optional with a Lens

                                      1.0.0

                                    method composeOptional

                                    composeOptional: <B>(ab: Optional<A, B>) => Optional<S, B>;
                                    • Alias of compose

                                      1.0.0

                                    method composePrism

                                    composePrism: <B>(ab: Prism<A, B>) => Optional<S, B>;
                                    • compose an Optional with a Prism

                                      1.0.0

                                    method composeSetter

                                    composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                                    • compose an Optional with a Setter

                                      1.0.0

                                    method composeTraversal

                                    composeTraversal: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                                    • compose an Optional with a Traversal

                                      1.0.0

                                    method fromNullableProp

                                    static fromNullableProp: <S>() => <K extends keyof S>(
                                    k: K
                                    ) => Optional<S, NonNullable<S[K]>>;
                                    • Example 1

                                      import { Optional } from 'monocle-ts'

                                      interface S { a: number | undefined | null }

                                      const optional = Optional.fromNullableProp()('a')

                                      const s1: S = { a: undefined } const s2: S = { a: null } const s3: S = { a: 1 }

                                      assert.deepStrictEqual(optional.set(2)(s1), s1) assert.deepStrictEqual(optional.set(2)(s2), s2) assert.deepStrictEqual(optional.set(2)(s3), { a: 2 })

                                      1.0.0

                                    method fromOptionProp

                                    static fromOptionProp: <S>() => <P extends OptionPropertyNames<S>>(
                                    prop: P
                                    ) => Optional<S, OptionPropertyType<S, P>>;
                                    • Returns an Optional from an option (Option<A>) prop

                                      Example 1

                                      import { Optional } from 'monocle-ts' import * as O from 'fp-ts/Option'

                                      interface S { a: O.Option }

                                      const optional = Optional.fromOptionProp()('a') const s1: S = { a: O.none } const s2: S = { a: O.some(1) } assert.deepStrictEqual(optional.set(2)(s1), s1) assert.deepStrictEqual(optional.set(2)(s2), { a: O.some(2) })

                                      1.0.0

                                    method fromPath

                                    static fromPath: <S>() => OptionalFromPath<S>;
                                    • Returns an Optional from a nullable (A | null | undefined) prop

                                      Example 1

                                      import { Optional } from 'monocle-ts'

                                      interface Phone { number: string } interface Employment { phone?: Phone } interface Info { employment?: Employment } interface Response { info?: Info }

                                      const numberFromResponse = Optional.fromPath()(['info', 'employment', 'phone', 'number'])

                                      const response1: Response = { info: { employment: { phone: { number: '555-1234' } } } } const response2: Response = { info: { employment: {} } }

                                      numberFromResponse.getOption(response1) // some('555-1234') numberFromResponse.getOption(response2) // none

                                      2.1.0

                                    method modify

                                    modify: (f: (a: A) => A) => (s: S) => S;
                                    • 1.0.0

                                    method modifyOption

                                    modifyOption: (f: (a: A) => A) => (s: S) => Option<S>;
                                    • 1.0.0

                                    class Prism

                                    class Prism<S, A> {}
                                    • Laws: 1. pipe(getOption(s), fold(() => s, reverseGet)) = s 2. getOption(reverseGet(a)) = some(a)

                                      constructor 1.0.0

                                    constructor

                                    constructor(getOption: (s: S) => Option<A>, reverseGet: (a: A) => S);

                                      property getOption

                                      readonly getOption: (s: S) => Option<A>;

                                        property reverseGet

                                        readonly reverseGet: (a: A) => S;

                                          method asFold

                                          asFold: () => Fold<S, A>;
                                          • view a Prism as a Fold

                                            1.0.0

                                          method asOptional

                                          asOptional: () => Optional<S, A>;
                                          • view a Prism as a Optional

                                            1.0.0

                                          method asSetter

                                          asSetter: () => Setter<S, A>;
                                          • view a Prism as a Setter

                                            1.0.0

                                          method asTraversal

                                          asTraversal: () => Traversal<S, A>;
                                          • view a Prism as a Traversal

                                            1.0.0

                                          method compose

                                          compose: <B>(ab: Prism<A, B>) => Prism<S, B>;
                                          • compose a Prism with a Prism

                                            1.0.0

                                          method composeFold

                                          composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
                                          • compose a Prism with a Fold

                                            1.0.0

                                          method composeGetter

                                          composeGetter: <B>(ab: Getter<A, B>) => Fold<S, B>;
                                          • compose a Prism with a Getter

                                            1.0.0

                                          method composeIso

                                          composeIso: <B>(ab: Iso<A, B>) => Prism<S, B>;
                                          • compose a Prism with a Iso

                                            1.0.0

                                          method composeLens

                                          composeLens: <B>(ab: Lens<A, B>) => Optional<S, B>;
                                          • compose a Prism with a Lens

                                            1.0.0

                                          method composeOptional

                                          composeOptional: <B>(ab: Optional<A, B>) => Optional<S, B>;
                                          • compose a Prism with a Optional

                                            1.0.0

                                          method composePrism

                                          composePrism: <B>(ab: Prism<A, B>) => Prism<S, B>;
                                          • Alias of compose

                                            1.0.0

                                          method composeSetter

                                          composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                                          • compose a Prism with a Setter

                                            1.0.0

                                          method composeTraversal

                                          composeTraversal: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                                          • compose a Prism with a Traversal

                                            1.0.0

                                          method fromPredicate

                                          static fromPredicate: {
                                          <S, A extends S>(refinement: Refinement<S, A>): Prism<S, A>;
                                          <A>(predicate: Predicate<A>): Prism<A, A>;
                                          };
                                          • 1.0.0

                                          method modify

                                          modify: (f: (a: A) => A) => (s: S) => S;
                                          • 1.0.0

                                          method modifyOption

                                          modifyOption: (f: (a: A) => A) => (s: S) => Option<S>;
                                          • 1.0.0

                                          method set

                                          set: (a: A) => (s: S) => S;
                                          • set the target of a Prism with a value

                                            1.0.0

                                          method some

                                          static some: <A>() => Prism<Option<A>, A>;
                                          • 1.0.0

                                          class Setter

                                          class Setter<S, A> {}
                                          • constructor 1.0.0

                                          constructor

                                          constructor(modify: (f: (a: A) => A) => (s: S) => S);

                                            property modify

                                            readonly modify: (f: (a: A) => A) => (s: S) => S;

                                              method compose

                                              compose: <B>(ab: Setter<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Setter

                                                1.0.0

                                              method composeIso

                                              composeIso: <B>(ab: Iso<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Iso

                                                1.0.0

                                              method composeLens

                                              composeLens: <B>(ab: Lens<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Lens

                                                1.0.0

                                              method composeOptional

                                              composeOptional: <B>(ab: Optional<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Optional

                                                1.0.0

                                              method composePrism

                                              composePrism: <B>(ab: Prism<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Prism

                                                1.0.0

                                              method composeSetter

                                              composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                                              • Alias of compose

                                                1.0.0

                                              method composeTraversal

                                              composeTraversal: <B>(ab: Traversal<A, B>) => Setter<S, B>;
                                              • compose a Setter with a Traversal

                                                1.0.0

                                              method set

                                              set: (a: A) => (s: S) => S;
                                              • 1.0.0

                                              class Traversal

                                              class Traversal<S, A> {}
                                              • constructor 1.0.0

                                              constructor

                                              constructor(modifyF: ModifyF<S, A>);

                                                property modifyF

                                                readonly modifyF: ModifyF<S, A>;

                                                  method asFold

                                                  asFold: () => Fold<S, A>;
                                                  • view a Traversal as a Fold

                                                    1.0.0

                                                  method asSetter

                                                  asSetter: () => Setter<S, A>;
                                                  • view a Traversal as a Setter

                                                    1.0.0

                                                  method compose

                                                  compose: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                                                  • compose a Traversal with a Traversal

                                                    1.0.0

                                                  method composeFold

                                                  composeFold: <B>(ab: Fold<A, B>) => Fold<S, B>;
                                                  • compose a Traversal with a Fold

                                                    1.0.0

                                                  method composeGetter

                                                  composeGetter: <B>(ab: Getter<A, B>) => Fold<S, B>;
                                                  • compose a Traversal with a Getter

                                                    1.0.0

                                                  method composeIso

                                                  composeIso: <B>(ab: Iso<A, B>) => Traversal<S, B>;
                                                  • compose a Traversal with a Iso

                                                    1.0.0

                                                  method composeLens

                                                  composeLens: <B>(ab: Lens<A, B>) => Traversal<S, B>;
                                                  • compose a Traversal with a Lens

                                                    1.0.0

                                                  method composeOptional

                                                  composeOptional: <B>(ab: Optional<A, B>) => Traversal<S, B>;
                                                  • compose a Traversal with a Optional

                                                    1.0.0

                                                  method composePrism

                                                  composePrism: <B>(ab: Prism<A, B>) => Traversal<S, B>;
                                                  • compose a Traversal with a Prism

                                                    1.0.0

                                                  method composeSetter

                                                  composeSetter: <B>(ab: Setter<A, B>) => Setter<S, B>;
                                                  • compose a Traversal with a Setter

                                                    1.0.0

                                                  method composeTraversal

                                                  composeTraversal: <B>(ab: Traversal<A, B>) => Traversal<S, B>;
                                                  • Alias of compose

                                                    1.0.0

                                                  method filter

                                                  filter: {
                                                  <B extends A>(refinement: Refinement<A, B>): Traversal<S, B>;
                                                  (predicate: Predicate<A>): Traversal<S, A>;
                                                  };
                                                  • focus the items matched by a traversal to those that match a predicate

                                                    Example 1

                                                    import { fromTraversable, Lens } from 'monocle-ts' import { Traversable } from 'fp-ts/Array'

                                                    interface Person { name: string; cool: boolean; }

                                                    const peopleTraversal = fromTraversable(Traversable)() const coolLens = Lens.fromProp()('cool') const people = [{name: 'bill', cool: false}, {name: 'jill', cool: true}]

                                                    const actual = peopleTraversal.filter(p => p.name === 'bill').composeLens(coolLens) .set(true)(people)

                                                    assert.deepStrictEqual(actual, [{name: 'bill', cool: true}, {name: 'jill', cool: true}])

                                                    1.0.0

                                                  method modify

                                                  modify: (f: (a: A) => A) => (s: S) => S;
                                                  • 1.0.0

                                                  method set

                                                  set: (a: A) => (s: S) => S;
                                                  • 1.0.0

                                                  Interfaces

                                                  interface LensFromPath

                                                  interface LensFromPath<S> {}
                                                  • 1.3.0

                                                  call signature

                                                  <
                                                  K1 extends keyof S,
                                                  K2 extends keyof S[K1],
                                                  K3 extends keyof S[K1][K2],
                                                  K4 extends keyof S[K1][K2][K3],
                                                  K5 extends keyof S[K1][K2][K3][K4]
                                                  >(
                                                  path: [K1, K2, K3, K4, K5]
                                                  ): Lens<S, S[K1][K2][K3][K4][K5]>;

                                                    call signature

                                                    <
                                                    K1 extends keyof S,
                                                    K2 extends keyof S[K1],
                                                    K3 extends keyof S[K1][K2],
                                                    K4 extends keyof S[K1][K2][K3]
                                                    >(
                                                    path: [K1, K2, K3, K4]
                                                    ): Lens<S, S[K1][K2][K3][K4]>;

                                                      call signature

                                                      <K1 extends keyof S, K2 extends keyof S[K1], K3 extends keyof S[K1][K2]>(
                                                      path: [K1, K2, K3]
                                                      ): Lens<S, S[K1][K2][K3]>;

                                                        call signature

                                                        <K1 extends keyof S, K2 extends keyof S[K1]>(path: [K1, K2]): Lens<S, S[K1][K2]>;

                                                          call signature

                                                          <K1 extends keyof S>(path: [K1]): Lens<S, S[K1]>;

                                                            interface OptionalFromPath

                                                            interface OptionalFromPath<S> {}
                                                            • 2.1.0

                                                            call signature

                                                            <
                                                            K1 extends keyof S,
                                                            K2 extends keyof NonNullable<S[K1]>,
                                                            K3 extends keyof NonNullable<NonNullable<S[K1]>[K2]>,
                                                            K4 extends keyof NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>,
                                                            K5 extends keyof NonNullable<
                                                            NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>[K4]
                                                            >
                                                            >(
                                                            path: [K1, K2, K3, K4, K5]
                                                            ): Optional<
                                                            S,
                                                            NonNullable<
                                                            NonNullable<NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>[K4]>[K5]
                                                            >
                                                            >;

                                                              call signature

                                                              <
                                                              K1 extends keyof S,
                                                              K2 extends keyof NonNullable<S[K1]>,
                                                              K3 extends keyof NonNullable<NonNullable<S[K1]>[K2]>,
                                                              K4 extends keyof NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>
                                                              >(
                                                              path: [K1, K2, K3, K4]
                                                              ): Optional<
                                                              S,
                                                              NonNullable<NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>[K4]>
                                                              >;

                                                                call signature

                                                                <
                                                                K1 extends keyof S,
                                                                K2 extends keyof NonNullable<S[K1]>,
                                                                K3 extends keyof NonNullable<NonNullable<S[K1]>[K2]>
                                                                >(
                                                                path: [K1, K2, K3]
                                                                ): Optional<S, NonNullable<NonNullable<NonNullable<S[K1]>[K2]>[K3]>>;

                                                                  call signature

                                                                  <K1 extends keyof S, K2 extends keyof NonNullable<S[K1]>>(
                                                                  path: [K1, K2]
                                                                  ): Optional<S, NonNullable<NonNullable<S[K1]>[K2]>>;

                                                                    call signature

                                                                    <K1 extends keyof S>(path: [K1]): Optional<S, NonNullable<S[K1]>>;

                                                                      Type Aliases

                                                                      type ModifyF

                                                                      type ModifyF<S, A> = traversal.ModifyF<S, A>;
                                                                      • 1.0.0

                                                                      Namespaces

                                                                      namespace at

                                                                      module 'lib/At.d.ts' {}
                                                                      • **This module is experimental**

                                                                        Experimental features are published in order to get early feedback from the community.

                                                                        A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                        2.3.0

                                                                      function at

                                                                      at: <S, I, A>(at: (i: I) => Lens<S, A>) => At<S, I, A>;
                                                                      • constructors 2.3.8

                                                                      function atReadonlyMap

                                                                      atReadonlyMap: <K>(
                                                                      E: Eq<K>
                                                                      ) => <A = never>() => At<ReadonlyMap<K, A>, K, O.Option<A>>;
                                                                      • constructors 2.3.7

                                                                      function atReadonlyRecord

                                                                      atReadonlyRecord: <A = never>() => At<
                                                                      ReadonlyRecord<string, A>,
                                                                      string,
                                                                      Option<A>
                                                                      >;
                                                                      • constructors 2.3.7

                                                                      function atReadonlySet

                                                                      atReadonlySet: <A>(E: Eq<A>) => At<ReadonlySet<A>, A, boolean>;
                                                                      • constructors 2.3.7

                                                                      function atRecord

                                                                      atRecord: <A = never>() => At<ReadonlyRecord<string, A>, string, Option<A>>;
                                                                      • Use atReadonlyRecord instead.

                                                                        constructors 2.3.2

                                                                        Deprecated

                                                                      function fromIso

                                                                      fromIso: <T, S>(iso: Iso<T, S>) => <I, A>(sia: At<S, I, A>) => At<T, I, A>;
                                                                      • Lift an instance of At using an Iso.

                                                                        constructors 2.3.0

                                                                      interface At

                                                                      interface At<S, I, A> {}
                                                                      • model 2.3.0

                                                                      property at

                                                                      readonly at: (i: I) => Lens<S, A>;

                                                                        namespace index

                                                                        module 'lib/Ix.d.ts' {}
                                                                        • **This module is experimental**

                                                                          Experimental features are published in order to get early feedback from the community.

                                                                          A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                          2.3.0

                                                                        function fromAt

                                                                        fromAt: <T, J, B>(at: At<T, J, O.Option<B>>) => Index<T, J, B>;
                                                                        • constructors 2.3.0

                                                                        function fromIso

                                                                        fromIso: <T, S>(iso: Iso<T, S>) => <I, A>(sia: Index<S, I, A>) => Index<T, I, A>;
                                                                        • Lift an instance of Index using an Iso.

                                                                          constructors 2.3.0

                                                                        function index

                                                                        index: <S, I, A>(index: (i: I) => Optional<S, A>) => Index<S, I, A>;
                                                                        • constructors 2.3.8

                                                                        function indexArray

                                                                        indexArray: <A = never>() => Index<readonly A[], number, A>;
                                                                        • Use indexReadonlyArray instead.

                                                                          constructors 2.3.2

                                                                          Deprecated

                                                                        function indexReadonlyArray

                                                                        indexReadonlyArray: <A = never>() => Index<readonly A[], number, A>;
                                                                        • constructors 2.3.7

                                                                        function indexReadonlyMap

                                                                        indexReadonlyMap: <K>(
                                                                        E: Eq<K>
                                                                        ) => <A = never>() => Index<ReadonlyMap<K, A>, K, A>;
                                                                        • constructors 2.3.7

                                                                        function indexReadonlyNonEmptyArray

                                                                        indexReadonlyNonEmptyArray: <A = never>() => Index<
                                                                        ReadonlyNonEmptyArray<A>,
                                                                        number,
                                                                        A
                                                                        >;
                                                                        • constructors 2.3.8

                                                                        function indexReadonlyRecord

                                                                        indexReadonlyRecord: <A = never>() => Index<
                                                                        ReadonlyRecord<string, A>,
                                                                        string,
                                                                        A
                                                                        >;
                                                                        • constructors 2.3.7

                                                                        function indexRecord

                                                                        indexRecord: <A = never>() => Index<ReadonlyRecord<string, A>, string, A>;
                                                                        • Use indexReadonlyRecord instead.

                                                                          constructors 2.3.2

                                                                          Deprecated

                                                                        interface Index

                                                                        interface Index<S, I, A> {}
                                                                        • model 2.3.0

                                                                        property index

                                                                        readonly index: (i: I) => Optional<S, A>;

                                                                          namespace iso

                                                                          module 'lib/Iso.d.ts' {}
                                                                          • **This module is experimental**

                                                                            Experimental features are published in order to get early feedback from the community.

                                                                            A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                            An Iso is an optic which converts elements of type S into elements of type A without loss.

                                                                            Laws:

                                                                            1. reverseGet(get(s)) = s 2. get(reversetGet(a)) = a

                                                                            2.3.0

                                                                          variable Category

                                                                          const Category: Category2<'monocle-ts/Iso'>;
                                                                          • instances 2.3.0

                                                                          variable Invariant

                                                                          const Invariant: Invariant2<'monocle-ts/Iso'>;
                                                                          • instances 2.3.0

                                                                          variable Semigroupoid

                                                                          const Semigroupoid: Semigroupoid2<'monocle-ts/Iso'>;
                                                                          • instances 2.3.8

                                                                          variable URI

                                                                          const URI: string;
                                                                          • instances 2.3.0

                                                                          function asLens

                                                                          asLens: <S, A>(sa: Iso<S, A>) => Lens<S, A>;
                                                                          • View an Iso as a Lens.

                                                                            converters 2.3.0

                                                                          function asOptional

                                                                          asOptional: <S, A>(sa: Iso<S, A>) => Optional<S, A>;
                                                                          • View an Iso as a Optional.

                                                                            converters 2.3.0

                                                                          function asPrism

                                                                          asPrism: <S, A>(sa: Iso<S, A>) => Prism<S, A>;
                                                                          • View an Iso as a Prism.

                                                                            converters 2.3.0

                                                                          function asTraversal

                                                                          asTraversal: <S, A>(sa: Iso<S, A>) => Traversal<S, A>;
                                                                          • View an Iso as a Traversal.

                                                                            converters 2.3.0

                                                                          function atKey

                                                                          atKey: (
                                                                          key: string
                                                                          ) => <S, A>(sa: Iso<S, Readonly<Record<string, A>>>) => Lens<S, Option<A>>;
                                                                          • Return a Lens from a Iso focused on a required key of a ReadonlyRecord.

                                                                            combinators 2.3.8

                                                                          function component

                                                                          component: <A extends readonly unknown[], P extends keyof A>(
                                                                          prop: P
                                                                          ) => <S>(sa: Iso<S, A>) => Lens<S, A[P]>;
                                                                          • Return a Lens from a Iso focused on a component of a tuple.

                                                                            combinators 2.3.8

                                                                          function compose

                                                                          compose: <A, B>(ab: Iso<A, B>) => <S>(sa: Iso<S, A>) => Iso<S, B>;
                                                                          • Compose an Iso with an Iso.

                                                                            compositions 2.3.0

                                                                          function composeIso

                                                                          composeIso: <A, B>(ab: Iso<A, B>) => <S>(sa: Iso<S, A>) => Iso<S, B>;
                                                                          • Alias of compose.

                                                                            compositions 2.3.8

                                                                          function composeLens

                                                                          composeLens: <A, B>(ab: Lens<A, B>) => <S>(sa: Iso<S, A>) => Lens<S, B>;
                                                                          • Compose an Iso with a Lens.

                                                                            compositions 2.3.8

                                                                          function composeOptional

                                                                          composeOptional: <A, B>(
                                                                          ab: Optional<A, B>
                                                                          ) => <S>(sa: Iso<S, A>) => Optional<S, B>;
                                                                          • Compose an Iso with a Optional.

                                                                            compositions 2.3.8

                                                                          function composePrism

                                                                          composePrism: <A, B>(ab: Prism<A, B>) => <S>(sa: Iso<S, A>) => Prism<S, B>;
                                                                          • Compose an Iso with a Prism.

                                                                            compositions 2.3.8

                                                                          function composeTraversal

                                                                          composeTraversal: <A, B>(
                                                                          ab: Traversal<A, B>
                                                                          ) => <S>(sa: Iso<S, A>) => Traversal<S, B>;
                                                                          • Compose an Iso with a Traversal.

                                                                            compositions 2.3.8

                                                                          function filter

                                                                          filter: {
                                                                          <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                          sa: Iso<S, A>
                                                                          ) => Prism<S, B>;
                                                                          <A>(predicate: Predicate<A>): <S>(sa: Iso<S, A>) => Prism<S, A>;
                                                                          };
                                                                          • combinators 2.3.8

                                                                          function findFirst

                                                                          findFirst: {
                                                                          <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                          sa: Iso<S, readonly A[]>
                                                                          ) => Optional<S, B>;
                                                                          <A>(predicate: Predicate<A>): <S>(sa: Iso<S, readonly A[]>) => Optional<S, A>;
                                                                          };
                                                                          • combinators 2.3.8

                                                                          function findFirstNonEmpty

                                                                          findFirstNonEmpty: {
                                                                          <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                          sa: Iso<S, ReadonlyNonEmptyArray<A>>
                                                                          ) => Optional<S, B>;
                                                                          <A>(predicate: Predicate<A>): <S>(
                                                                          sa: Iso<S, ReadonlyNonEmptyArray<A>>
                                                                          ) => Optional<S, A>;
                                                                          };
                                                                          • combinators 2.3.8

                                                                          function fromNullable

                                                                          fromNullable: <S, A>(sa: Iso<S, A>) => Prism<S, NonNullable<A>>;
                                                                          • Return a Prism from a Iso focused on a nullable value.

                                                                            combinators 2.3.8

                                                                          function id

                                                                          id: <S>() => Iso<S, S>;
                                                                          • constructors 2.3.0

                                                                          function imap

                                                                          imap: <A, B>(f: (a: A) => B, g: (b: B) => A) => <S>(sa: Iso<S, A>) => Iso<S, B>;
                                                                          • Invariant 2.3.0

                                                                          function index

                                                                          index: (i: number) => <S, A>(sa: Iso<S, readonly A[]>) => Optional<S, A>;
                                                                          • Return a Optional from a Iso focused on an index of a ReadonlyArray.

                                                                            combinators 2.3.8

                                                                          function indexNonEmpty

                                                                          indexNonEmpty: (
                                                                          i: number
                                                                          ) => <S, A>(sa: Iso<S, ReadonlyNonEmptyArray<A>>) => Optional<S, A>;
                                                                          • Return a Optional from a Iso focused on an index of a ReadonlyNonEmptyArray.

                                                                            combinators 2.3.8

                                                                          function iso

                                                                          iso: <S, A>(get: (s: S) => A, reverseGet: (a: A) => S) => Iso<S, A>;
                                                                          • constructors 2.3.8

                                                                          function key

                                                                          key: (
                                                                          key: string
                                                                          ) => <S, A>(sa: Iso<S, Readonly<Record<string, A>>>) => Optional<S, A>;
                                                                          • Return a Optional from a Iso focused on a key of a ReadonlyRecord.

                                                                            combinators 2.3.8

                                                                          function left

                                                                          left: <S, E, A>(sea: Iso<S, Either<E, A>>) => Prism<S, E>;
                                                                          • Return a Prism from a Iso focused on the Left of a Either type.

                                                                            combinators 2.3.8

                                                                          function modify

                                                                          modify: <A, B extends A = A>(
                                                                          f: (a: A) => B
                                                                          ) => <S>(sa: Iso<S, A>) => (s: S) => S;
                                                                          • combinators 2.3.0

                                                                          function modifyF

                                                                          modifyF: {
                                                                          <F extends URIS3>(F: Functor3<F>): <A, R, E>(
                                                                          f: (a: A) => Kind3<F, R, E, A>
                                                                          ) => <S>(sa: Iso<S, A>) => (s: S) => Kind3<F, R, E, S>;
                                                                          <F extends URIS2>(F: Functor2<F>): <A, E>(
                                                                          f: (a: A) => Kind2<F, E, A>
                                                                          ) => <S>(sa: Iso<S, A>) => (s: S) => Kind2<F, E, S>;
                                                                          <F extends URIS>(F: Functor1<F>): <A>(
                                                                          f: (a: A) => Kind<F, A>
                                                                          ) => <S>(sa: Iso<S, A>) => (s: S) => Kind<F, S>;
                                                                          <F>(F: Functor<F>): <A>(
                                                                          f: (a: A) => HKT<F, A>
                                                                          ) => <S>(sa: Iso<S, A>) => (s: S) => HKT<F, S>;
                                                                          };
                                                                          • combinators 2.3.5

                                                                          function prop

                                                                          prop: <A, P extends keyof A>(prop: P) => <S>(sa: Iso<S, A>) => Lens<S, A[P]>;
                                                                          • Return a Lens from a Iso and a prop.

                                                                            combinators 2.3.8

                                                                          function props

                                                                          props: <A, P extends keyof A>(
                                                                          props_0: P,
                                                                          props_1: P,
                                                                          ...props_2: P[]
                                                                          ) => <S>(sa: Iso<S, A>) => Lens<S, { [K in P]: A[K] }>;
                                                                          • Return a Lens from a Iso and a list of props.

                                                                            combinators 2.3.8

                                                                          function reverse

                                                                          reverse: <S, A>(sa: Iso<S, A>) => Iso<A, S>;
                                                                          • constructors 2.3.0

                                                                          function right

                                                                          right: <S, E, A>(sea: Iso<S, Either<E, A>>) => Prism<S, A>;
                                                                          • Return a Prism from a Iso focused on the Right of a Either type.

                                                                            combinators 2.3.8

                                                                          function some

                                                                          some: <S, A>(soa: Iso<S, Option<A>>) => Prism<S, A>;
                                                                          • Return a Prism from a Iso focused on the Some of a Option type.

                                                                            combinators 2.3.8

                                                                          function traverse

                                                                          traverse: <T extends URIS>(
                                                                          T: Traversable1<T>
                                                                          ) => <S, A>(sta: Iso<S, Kind<T, A>>) => Traversal<S, A>;
                                                                          • Return a Traversal from a Iso focused on a Traversable.

                                                                            combinators 2.3.8

                                                                          interface Iso

                                                                          interface Iso<S, A> {}
                                                                          • model 2.3.0

                                                                          property get

                                                                          readonly get: (s: S) => A;

                                                                            property reverseGet

                                                                            readonly reverseGet: (a: A) => S;

                                                                              type URI

                                                                              type URI = typeof URI;
                                                                              • instances 2.3.0

                                                                              namespace lens

                                                                              module 'lib/Lens.d.ts' {}
                                                                              • **This module is experimental**

                                                                                Experimental features are published in order to get early feedback from the community.

                                                                                A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                                A Lens is an optic used to zoom inside a product.

                                                                                Lenses have two type parameters generally called S and A: Lens<S, A> where S represents the product and A an element inside of S.

                                                                                Laws:

                                                                                1. get(set(a)(s)) = a 2. set(get(s))(s) = s 3. set(a)(set(a)(s)) = set(a)(s)

                                                                                2.3.0

                                                                              variable Category

                                                                              const Category: Category2<'monocle-ts/Lens'>;
                                                                              • instances 2.3.0

                                                                              variable Invariant

                                                                              const Invariant: Invariant2<'monocle-ts/Lens'>;
                                                                              • instances 2.3.0

                                                                              variable Semigroupoid

                                                                              const Semigroupoid: Semigroupoid2<'monocle-ts/Lens'>;
                                                                              • instances 2.3.8

                                                                              variable URI

                                                                              const URI: string;
                                                                              • instances 2.3.0

                                                                              function asOptional

                                                                              asOptional: <S, A>(sa: Lens<S, A>) => Optional<S, A>;
                                                                              • View a Lens as a Optional.

                                                                                converters 2.3.0

                                                                              function asTraversal

                                                                              asTraversal: <S, A>(sa: Lens<S, A>) => Traversal<S, A>;
                                                                              • View a Lens as a Traversal.

                                                                                converters 2.3.0

                                                                              function atKey

                                                                              atKey: (
                                                                              key: string
                                                                              ) => <S, A>(sa: Lens<S, ReadonlyRecord<string, A>>) => Lens<S, Option<A>>;
                                                                              • Return a Lens from a Lens focused on a required key of a ReadonlyRecord.

                                                                                combinators 2.3.0

                                                                              function component

                                                                              component: <A extends readonly unknown[], P extends keyof A>(
                                                                              prop: P
                                                                              ) => <S>(sa: Lens<S, A>) => Lens<S, A[P]>;
                                                                              • Return a Lens from a Lens focused on a component of a tuple.

                                                                                combinators 2.3.0

                                                                              function compose

                                                                              compose: <A, B>(ab: Lens<A, B>) => <S>(sa: Lens<S, A>) => Lens<S, B>;
                                                                              • Compose a Lens with a Lens.

                                                                                compositions 2.3.0

                                                                              function composeIso

                                                                              composeIso: <A, B>(ab: Iso<A, B>) => <S>(sa: Lens<S, A>) => Lens<S, B>;
                                                                              • Compose a Lens with a Iso.

                                                                                compositions 2.3.8

                                                                              function composeLens

                                                                              composeLens: <A, B>(ab: Lens<A, B>) => <S>(sa: Lens<S, A>) => Lens<S, B>;
                                                                              • Alias of compose.

                                                                                compositions 2.3.8

                                                                              function composeOptional

                                                                              composeOptional: <A, B>(
                                                                              ab: Optional<A, B>
                                                                              ) => <S>(sa: Lens<S, A>) => Optional<S, B>;
                                                                              • Compose a Lens with an Optional.

                                                                                compositions 2.3.0

                                                                              function composePrism

                                                                              composePrism: <A, B>(ab: Prism<A, B>) => <S>(sa: Lens<S, A>) => Optional<S, B>;
                                                                              • Compose a Lens with a Prism.

                                                                                compositions 2.3.0

                                                                              function composeTraversal

                                                                              composeTraversal: <A, B>(
                                                                              ab: Traversal<A, B>
                                                                              ) => <S>(sa: Lens<S, A>) => Traversal<S, B>;
                                                                              • Compose a Lens with an Traversal.

                                                                                compositions 2.3.8

                                                                              function filter

                                                                              filter: {
                                                                              <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                              sa: Lens<S, A>
                                                                              ) => Optional<S, B>;
                                                                              <A>(predicate: Predicate<A>): <S>(sa: Lens<S, A>) => Optional<S, A>;
                                                                              };
                                                                              • combinators 2.3.0

                                                                              function findFirst

                                                                              findFirst: {
                                                                              <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                              sa: Lens<S, readonly A[]>
                                                                              ) => Optional<S, B>;
                                                                              <A>(predicate: Predicate<A>): <S>(sa: Lens<S, readonly A[]>) => Optional<S, A>;
                                                                              };
                                                                              • combinators 2.3.2

                                                                              function findFirstNonEmpty

                                                                              findFirstNonEmpty: {
                                                                              <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                              sa: Lens<S, ReadonlyNonEmptyArray<A>>
                                                                              ) => Optional<S, B>;
                                                                              <A>(predicate: Predicate<A>): <S>(
                                                                              sa: Lens<S, ReadonlyNonEmptyArray<A>>
                                                                              ) => Optional<S, A>;
                                                                              };
                                                                              • combinators 2.3.8

                                                                              function fromNullable

                                                                              fromNullable: <S, A>(sa: Lens<S, A>) => Optional<S, NonNullable<A>>;
                                                                              • Return a Optional from a Lens focused on a nullable value.

                                                                                combinators 2.3.0

                                                                              function id

                                                                              id: <S>() => Lens<S, S>;
                                                                              • constructors 2.3.0

                                                                              function imap

                                                                              imap: <A, B>(
                                                                              f: (a: A) => B,
                                                                              g: (b: B) => A
                                                                              ) => <E>(sa: Lens<E, A>) => Lens<E, B>;
                                                                              • Invariant 2.3.0

                                                                              function index

                                                                              index: (i: number) => <S, A>(sa: Lens<S, readonly A[]>) => Optional<S, A>;
                                                                              • Return a Optional from a Lens focused on an index of a ReadonlyArray.

                                                                                combinators 2.3.0

                                                                              function indexNonEmpty

                                                                              indexNonEmpty: (
                                                                              i: number
                                                                              ) => <S, A>(sa: Lens<S, ReadonlyNonEmptyArray<A>>) => Optional<S, A>;
                                                                              • Return a Optional from a Lens focused on an index of a ReadonlyNonEmptyArray.

                                                                                combinators 2.3.8

                                                                              function key

                                                                              key: (
                                                                              key: string
                                                                              ) => <S, A>(sa: Lens<S, Readonly<Record<string, A>>>) => Optional<S, A>;
                                                                              • Return a Optional from a Lens focused on a key of a ReadonlyRecord.

                                                                                combinators 2.3.0

                                                                              function left

                                                                              left: <S, E, A>(sea: Lens<S, Either<E, A>>) => Optional<S, E>;
                                                                              • Return a Optional from a Lens focused on the Left of a Either type.

                                                                                combinators 2.3.0

                                                                              function lens

                                                                              lens: <S, A>(get: (s: S) => A, set: (a: A) => (s: S) => S) => Lens<S, A>;
                                                                              • constructors 2.3.8

                                                                              function modify

                                                                              modify: <A, B extends A = A>(
                                                                              f: (a: A) => B
                                                                              ) => <S>(sa: Lens<S, A>) => (s: S) => S;
                                                                              • combinators 2.3.0

                                                                              function modifyF

                                                                              modifyF: {
                                                                              <F extends URIS3>(F: Functor3<F>): <A, R, E>(
                                                                              f: (a: A) => Kind3<F, R, E, A>
                                                                              ) => <S>(sa: Lens<S, A>) => (s: S) => Kind3<F, R, E, S>;
                                                                              <F extends URIS2>(F: Functor2<F>): <A, E>(
                                                                              f: (a: A) => Kind2<F, E, A>
                                                                              ) => <S>(sa: Lens<S, A>) => (s: S) => Kind2<F, E, S>;
                                                                              <F extends URIS>(F: Functor1<F>): <A>(
                                                                              f: (a: A) => Kind<F, A>
                                                                              ) => <S>(sa: Lens<S, A>) => (s: S) => Kind<F, S>;
                                                                              <F>(F: Functor<F>): <A>(
                                                                              f: (a: A) => HKT<F, A>
                                                                              ) => <S>(sa: Lens<S, A>) => (s: S) => HKT<F, S>;
                                                                              };
                                                                              • combinators 2.3.5

                                                                              function prop

                                                                              prop: <A, P extends keyof A>(prop: P) => <S>(sa: Lens<S, A>) => Lens<S, A[P]>;
                                                                              • Return a Lens from a Lens and a prop.

                                                                                combinators 2.3.0

                                                                              function props

                                                                              props: <A, P extends keyof A>(
                                                                              props_0: P,
                                                                              props_1: P,
                                                                              ...props_2: P[]
                                                                              ) => <S>(sa: Lens<S, A>) => Lens<S, { [K in P]: A[K] }>;
                                                                              • Return a Lens from a Lens and a list of props.

                                                                                combinators 2.3.0

                                                                              function right

                                                                              right: <S, E, A>(sea: Lens<S, Either<E, A>>) => Optional<S, A>;
                                                                              • Return a Optional from a Lens focused on the Right of a Either type.

                                                                                combinators 2.3.0

                                                                              function some

                                                                              some: <S, A>(soa: Lens<S, Option<A>>) => Optional<S, A>;
                                                                              • Return a Optional from a Lens focused on the Some of a Option type.

                                                                                combinators 2.3.0

                                                                              function traverse

                                                                              traverse: <T extends URIS>(
                                                                              T: Traversable1<T>
                                                                              ) => <S, A>(sta: Lens<S, Kind<T, A>>) => Traversal<S, A>;
                                                                              • Return a Traversal from a Lens focused on a Traversable.

                                                                                combinators 2.3.0

                                                                              interface Lens

                                                                              interface Lens<S, A> {}
                                                                              • model 2.3.0

                                                                              property get

                                                                              readonly get: (s: S) => A;

                                                                                property set

                                                                                readonly set: (a: A) => (s: S) => S;

                                                                                  type URI

                                                                                  type URI = typeof URI;
                                                                                  • instances 2.3.0

                                                                                  namespace optional

                                                                                  module 'lib/Optional.d.ts' {}
                                                                                  • **This module is experimental**

                                                                                    Experimental features are published in order to get early feedback from the community.

                                                                                    A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                                    An Optional is an optic used to zoom inside a product. Unlike the Lens, the element that the Optional focuses on may not exist.

                                                                                    Optionals have two type parameters generally called S and A: Optional<S, A> where S represents the product and A an optional element inside of S.

                                                                                    Laws:

                                                                                    1. pipe(getOption(s), fold(() => s, a => set(a)(s))) = s 2. getOption(set(a)(s)) = pipe(getOption(s), map(_ => a)) 3. set(a)(set(a)(s)) = set(a)(s)

                                                                                    2.3.0

                                                                                  variable Category

                                                                                  const Category: Category2<'monocle-ts/Optional'>;
                                                                                  • instances 2.3.0

                                                                                  variable Invariant

                                                                                  const Invariant: Invariant2<'monocle-ts/Optional'>;
                                                                                  • instances 2.3.0

                                                                                  variable Semigroupoid

                                                                                  const Semigroupoid: Semigroupoid2<'monocle-ts/Optional'>;
                                                                                  • instances 2.3.8

                                                                                  variable URI

                                                                                  const URI: string;
                                                                                  • instances 2.3.0

                                                                                  function asTraversal

                                                                                  asTraversal: <S, A>(sa: Optional<S, A>) => Traversal<S, A>;
                                                                                  • View a Optional as a Traversal.

                                                                                    converters 2.3.0

                                                                                  function atKey

                                                                                  atKey: (
                                                                                  key: string
                                                                                  ) => <S, A>(
                                                                                  sa: Optional<S, Readonly<Record<string, A>>>
                                                                                  ) => Optional<S, O.Option<A>>;
                                                                                  • Return a Optional from a Optional focused on a required key of a ReadonlyRecord.

                                                                                    combinators 2.3.0

                                                                                  function component

                                                                                  component: <A extends readonly unknown[], P extends keyof A>(
                                                                                  prop: P
                                                                                  ) => <S>(sa: Optional<S, A>) => Optional<S, A[P]>;
                                                                                  • Return a Optional from a Optional focused on a component of a tuple.

                                                                                    combinators 2.3.0

                                                                                  function compose

                                                                                  compose: <A, B>(ab: Optional<A, B>) => <S>(sa: Optional<S, A>) => Optional<S, B>;
                                                                                  • Compose a Optional with a Optional.

                                                                                    compositions 2.3.0

                                                                                  function composeIso

                                                                                  composeIso: <A, B>(ab: Iso<A, B>) => <S>(sa: Optional<S, A>) => Optional<S, B>;
                                                                                  • Compose a Optional with a Iso.

                                                                                    compositions 2.3.8

                                                                                  function composeLens

                                                                                  composeLens: <A, B>(ab: Lens<A, B>) => <S>(sa: Optional<S, A>) => Optional<S, B>;
                                                                                  • Compose a Optional with a Lens.

                                                                                    compositions 2.3.7

                                                                                  function composeOptional

                                                                                  composeOptional: <A, B>(
                                                                                  ab: Optional<A, B>
                                                                                  ) => <S>(sa: Optional<S, A>) => Optional<S, B>;
                                                                                  • Alias of compose.

                                                                                    compositions 2.3.8

                                                                                  function composePrism

                                                                                  composePrism: <A, B>(
                                                                                  ab: Prism<A, B>
                                                                                  ) => <S>(sa: Optional<S, A>) => Optional<S, B>;
                                                                                  • Compose a Optional with a Prism.

                                                                                    compositions 2.3.7

                                                                                  function composeTraversal

                                                                                  composeTraversal: <A, B>(
                                                                                  ab: Traversal<A, B>
                                                                                  ) => <S>(sa: Optional<S, A>) => Traversal<S, B>;
                                                                                  • Compose a Optional with an Traversal.

                                                                                    compositions 2.3.8

                                                                                  function filter

                                                                                  filter: {
                                                                                  <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                  sa: Optional<S, A>
                                                                                  ) => Optional<S, B>;
                                                                                  <A>(predicate: Predicate<A>): <S>(sa: Optional<S, A>) => Optional<S, A>;
                                                                                  };
                                                                                  • combinators 2.3.0

                                                                                  function findFirst

                                                                                  findFirst: {
                                                                                  <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                  sa: Optional<S, readonly A[]>
                                                                                  ) => Optional<S, B>;
                                                                                  <A>(predicate: Predicate<A>): <S>(
                                                                                  sa: Optional<S, readonly A[]>
                                                                                  ) => Optional<S, A>;
                                                                                  };
                                                                                  • combinators 2.3.2

                                                                                  function findFirstNonEmpty

                                                                                  findFirstNonEmpty: {
                                                                                  <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                  sa: Optional<S, ReadonlyNonEmptyArray<A>>
                                                                                  ) => Optional<S, B>;
                                                                                  <A>(predicate: Predicate<A>): <S>(
                                                                                  sa: Optional<S, ReadonlyNonEmptyArray<A>>
                                                                                  ) => Optional<S, A>;
                                                                                  };
                                                                                  • combinators 2.3.8

                                                                                  function fromNullable

                                                                                  fromNullable: <S, A>(sa: Optional<S, A>) => Optional<S, NonNullable<A>>;
                                                                                  • Return an Optional from a Optional focused on a nullable value.

                                                                                    combinators 2.3.3

                                                                                  function id

                                                                                  id: <S>() => Optional<S, S>;
                                                                                  • constructors 2.3.0

                                                                                  function imap

                                                                                  imap: <A, B>(
                                                                                  f: (a: A) => B,
                                                                                  g: (b: B) => A
                                                                                  ) => <E>(fa: Optional<E, A>) => Optional<E, B>;
                                                                                  • Invariant 2.3.0

                                                                                  function index

                                                                                  index: (i: number) => <S, A>(sa: Optional<S, readonly A[]>) => Optional<S, A>;
                                                                                  • Return a Optional from a Optional focused on an index of a ReadonlyArray.

                                                                                    combinators 2.3.0

                                                                                  function indexNonEmpty

                                                                                  indexNonEmpty: (
                                                                                  i: number
                                                                                  ) => <S, A>(sa: Optional<S, ReadonlyNonEmptyArray<A>>) => Optional<S, A>;
                                                                                  • Return a Optional from a Optional focused on an index of a ReadonlyNonEmptyArray.

                                                                                    combinators 2.3.8

                                                                                  function key

                                                                                  key: (
                                                                                  key: string
                                                                                  ) => <S, A>(sa: Optional<S, ReadonlyRecord<string, A>>) => Optional<S, A>;
                                                                                  • Return a Optional from a Optional focused on a key of a ReadonlyRecord.

                                                                                    combinators 2.3.0

                                                                                  function left

                                                                                  left: <S, E, A>(sea: Optional<S, Either<E, A>>) => Optional<S, E>;
                                                                                  • Return a Optional from a Optional focused on the Left of a Either type.

                                                                                    combinators 2.3.0

                                                                                  function modify

                                                                                  modify: <A, B extends A = A>(
                                                                                  f: (a: A) => B
                                                                                  ) => <S>(optional: Optional<S, A>) => (s: S) => S;
                                                                                  • combinators 2.3.0

                                                                                  function modifyF

                                                                                  modifyF: {
                                                                                  <F extends URIS3>(F: Applicative3<F>): <A, R, E>(
                                                                                  f: (a: A) => Kind3<F, R, E, A>
                                                                                  ) => <S>(sa: Optional<S, A>) => (s: S) => Kind3<F, R, E, S>;
                                                                                  <F extends URIS2>(F: Applicative2<F>): <A, E>(
                                                                                  f: (a: A) => Kind2<F, E, A>
                                                                                  ) => <S>(sa: Optional<S, A>) => (s: S) => Kind2<F, E, S>;
                                                                                  <F extends URIS>(F: Applicative1<F>): <A>(
                                                                                  f: (a: A) => Kind<F, A>
                                                                                  ) => <S>(sa: Optional<S, A>) => (s: S) => Kind<F, S>;
                                                                                  <F>(F: Applicative<F>): <A>(
                                                                                  f: (a: A) => HKT<F, A>
                                                                                  ) => <S>(sa: Optional<S, A>) => (s: S) => HKT<F, S>;
                                                                                  };
                                                                                  • combinators 2.3.5

                                                                                  function modifyOption

                                                                                  modifyOption: <A, B extends A = A>(
                                                                                  f: (a: A) => B
                                                                                  ) => <S>(optional: Optional<S, A>) => (s: S) => Option<S>;
                                                                                  • combinators 2.3.0

                                                                                  function optional

                                                                                  optional: <S, A>(
                                                                                  getOption: (s: S) => Option<A>,
                                                                                  set: (a: A) => (s: S) => S
                                                                                  ) => Optional<S, A>;
                                                                                  • constructors 2.3.8

                                                                                  function prop

                                                                                  prop: <A, P extends keyof A>(
                                                                                  prop: P
                                                                                  ) => <S>(sa: Optional<S, A>) => Optional<S, A[P]>;
                                                                                  • Return a Optional from a Optional and a prop.

                                                                                    combinators 2.3.0

                                                                                  function props

                                                                                  props: <A, P extends keyof A>(
                                                                                  props_0: P,
                                                                                  props_1: P,
                                                                                  ...props_2: P[]
                                                                                  ) => <S>(sa: Optional<S, A>) => Optional<S, { [K in P]: A[K] }>;
                                                                                  • Return a Optional from a Optional and a list of props.

                                                                                    combinators 2.3.0

                                                                                  function right

                                                                                  right: <S, E, A>(sea: Optional<S, Either<E, A>>) => Optional<S, A>;
                                                                                  • Return a Optional from a Optional focused on the Right of a Either type.

                                                                                    combinators 2.3.0

                                                                                  function setOption

                                                                                  setOption: <A>(a: A) => <S>(optional: Optional<S, A>) => (s: S) => O.Option<S>;
                                                                                  • combinators 2.3.7

                                                                                  function some

                                                                                  some: <S, A>(soa: Optional<S, Option<A>>) => Optional<S, A>;
                                                                                  • Return a Optional from a Optional focused on the Some of a Option type.

                                                                                    combinators 2.3.0

                                                                                  function traverse

                                                                                  traverse: <T extends URIS>(
                                                                                  T: Traversable1<T>
                                                                                  ) => <S, A>(sta: Optional<S, Kind<T, A>>) => Traversal<S, A>;
                                                                                  • Return a Traversal from a Optional focused on a Traversable.

                                                                                    combinators 2.3.0

                                                                                  interface Optional

                                                                                  interface Optional<S, A> {}
                                                                                  • model 2.3.0

                                                                                  property getOption

                                                                                  readonly getOption: (s: S) => Option<A>;

                                                                                    property set

                                                                                    readonly set: (a: A) => (s: S) => S;

                                                                                      type URI

                                                                                      type URI = typeof URI;
                                                                                      • instances 2.3.0

                                                                                      namespace prism

                                                                                      module 'lib/Prism.d.ts' {}
                                                                                      • **This module is experimental**

                                                                                        Experimental features are published in order to get early feedback from the community.

                                                                                        A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                                        A Prism is an optic used to select part of a sum type.

                                                                                        Laws:

                                                                                        1. pipe(getOption(s), fold(() => s, reverseGet)) = s 2. getOption(reverseGet(a)) = some(a)

                                                                                        2.3.0

                                                                                      variable Category

                                                                                      const Category: Category2<'monocle-ts/Prism'>;
                                                                                      • instances 2.3.0

                                                                                      variable fromPredicate

                                                                                      const fromPredicate: {
                                                                                      <S, A extends S>(refinement: Refinement<S, A>): Prism<S, A>;
                                                                                      <A>(predicate: Predicate<A>): Prism<A, A>;
                                                                                      };
                                                                                      • constructors 2.3.0

                                                                                      variable Invariant

                                                                                      const Invariant: Invariant2<'monocle-ts/Prism'>;
                                                                                      • instances 2.3.0

                                                                                      variable Semigroupoid

                                                                                      const Semigroupoid: Semigroupoid2<'monocle-ts/Prism'>;
                                                                                      • instances 2.3.8

                                                                                      variable URI

                                                                                      const URI: string;
                                                                                      • instances 2.3.0

                                                                                      function asOptional

                                                                                      asOptional: <S, A>(sa: Prism<S, A>) => Optional<S, A>;
                                                                                      • View a Prism as a Optional.

                                                                                        converters 2.3.0

                                                                                      function asTraversal

                                                                                      asTraversal: <S, A>(sa: Prism<S, A>) => Traversal<S, A>;
                                                                                      • View a Prism as a Traversal.

                                                                                        converters 2.3.0

                                                                                      function atKey

                                                                                      atKey: (
                                                                                      key: string
                                                                                      ) => <S, A>(sa: Prism<S, Readonly<Record<string, A>>>) => Optional<S, O.Option<A>>;
                                                                                      • Return a Optional from a Prism focused on a required key of a ReadonlyRecord.

                                                                                        combinators 2.3.0

                                                                                      function component

                                                                                      component: <A extends readonly unknown[], P extends keyof A>(
                                                                                      prop: P
                                                                                      ) => <S>(sa: Prism<S, A>) => Optional<S, A[P]>;
                                                                                      • Return a Optional from a Prism focused on a component of a tuple.

                                                                                        combinators 2.3.0

                                                                                      function compose

                                                                                      compose: <A, B>(ab: Prism<A, B>) => <S>(sa: Prism<S, A>) => Prism<S, B>;
                                                                                      • Compose a Prism with a Prism.

                                                                                        compositions 2.3.0

                                                                                      function composeIso

                                                                                      composeIso: <A, B>(ab: Iso<A, B>) => <S>(sa: Prism<S, A>) => Prism<S, B>;
                                                                                      • Compose a Prism with a Iso.

                                                                                        compositions 2.3.8

                                                                                      function composeLens

                                                                                      composeLens: <A, B>(ab: Lens<A, B>) => <S>(sa: Prism<S, A>) => Optional<S, B>;
                                                                                      • Compose a Prism with a Lens.

                                                                                        compositions 2.3.0

                                                                                      function composeOptional

                                                                                      composeOptional: <A, B>(
                                                                                      ab: Optional<A, B>
                                                                                      ) => <S>(sa: Prism<S, A>) => Optional<S, B>;
                                                                                      • Compose a Prism with an Optional.

                                                                                        compositions 2.3.0

                                                                                      function composePrism

                                                                                      composePrism: <A, B>(ab: Prism<A, B>) => <S>(sa: Prism<S, A>) => Prism<S, B>;
                                                                                      • Alias of compose.

                                                                                        compositions 2.3.8

                                                                                      function composeTraversal

                                                                                      composeTraversal: <A, B>(
                                                                                      ab: Traversal<A, B>
                                                                                      ) => <S>(sa: Prism<S, A>) => Traversal<S, B>;
                                                                                      • Compose a Prism with an Traversal.

                                                                                        compositions 2.3.8

                                                                                      function filter

                                                                                      filter: {
                                                                                      <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                      sa: Prism<S, A>
                                                                                      ) => Prism<S, B>;
                                                                                      <A>(predicate: Predicate<A>): <S>(sa: Prism<S, A>) => Prism<S, A>;
                                                                                      };
                                                                                      • combinators 2.3.0

                                                                                      function findFirst

                                                                                      findFirst: {
                                                                                      <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                      sa: Prism<S, readonly A[]>
                                                                                      ) => Optional<S, B>;
                                                                                      <A>(predicate: Predicate<A>): <S>(sa: Prism<S, readonly A[]>) => Optional<S, A>;
                                                                                      };
                                                                                      • combinators 2.3.2

                                                                                      function findFirstNonEmpty

                                                                                      findFirstNonEmpty: {
                                                                                      <A, B extends A>(refinement: Refinement<A, B>): <S>(
                                                                                      sa: Prism<S, ReadonlyNonEmptyArray<A>>
                                                                                      ) => Optional<S, B>;
                                                                                      <A>(predicate: Predicate<A>): <S>(
                                                                                      sa: Prism<S, ReadonlyNonEmptyArray<A>>
                                                                                      ) => Optional<S, A>;
                                                                                      };
                                                                                      • combinators 2.3.8

                                                                                      function fromNullable

                                                                                      fromNullable: <S, A>(sa: Prism<S, A>) => Prism<S, NonNullable<A>>;
                                                                                      • Return a Prism from a Prism focused on a nullable value.

                                                                                        combinators 2.3.3

                                                                                      function id

                                                                                      id: <S>() => Prism<S, S>;
                                                                                      • constructors 2.3.0

                                                                                      function imap

                                                                                      imap: <A, B>(
                                                                                      f: (a: A) => B,
                                                                                      g: (b: B) => A
                                                                                      ) => <E>(sa: Prism<E, A>) => Prism<E, B>;
                                                                                      • Invariant 2.3.0

                                                                                      function index

                                                                                      index: (i: number) => <S, A>(sa: Prism<S, readonly A[]>) => Optional<S, A>;
                                                                                      • Return a Optional from a Prism focused on an index of a ReadonlyArray.

                                                                                        combinators 2.3.0

                                                                                      function indexNonEmpty

                                                                                      indexNonEmpty: (
                                                                                      i: number
                                                                                      ) => <S, A>(sa: Prism<S, ReadonlyNonEmptyArray<A>>) => Optional<S, A>;
                                                                                      • Return a Optional from a Prism focused on an index of a ReadonlyNonEmptyArray.

                                                                                        combinators 2.3.8

                                                                                      function key

                                                                                      key: (
                                                                                      key: string
                                                                                      ) => <S, A>(sa: Prism<S, Readonly<Record<string, A>>>) => Optional<S, A>;
                                                                                      • Return a Optional from a Prism focused on a key of a ReadonlyRecord.

                                                                                        combinators 2.3.0

                                                                                      function left

                                                                                      left: <S, E, A>(sea: Prism<S, Either<E, A>>) => Prism<S, E>;
                                                                                      • Return a Prism from a Prism focused on the Left of a Either type.

                                                                                        combinators 2.3.0

                                                                                      function modify

                                                                                      modify: <A, B extends A = A>(
                                                                                      f: (a: A) => B
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => S;
                                                                                      • combinators 2.3.0

                                                                                      function modifyF

                                                                                      modifyF: {
                                                                                      <F extends URIS3>(F: Applicative3<F>): <A, R, E>(
                                                                                      f: (a: A) => Kind3<F, R, E, A>
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => Kind3<F, R, E, S>;
                                                                                      <F extends URIS2>(F: Applicative2<F>): <A, E>(
                                                                                      f: (a: A) => Kind2<F, E, A>
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => Kind2<F, E, S>;
                                                                                      <F extends URIS>(F: Applicative1<F>): <A>(
                                                                                      f: (a: A) => Kind<F, A>
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => Kind<F, S>;
                                                                                      <F>(F: Applicative<F>): <A>(
                                                                                      f: (a: A) => HKT<F, A>
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => HKT<F, S>;
                                                                                      };
                                                                                      • combinators 2.3.5

                                                                                      function modifyOption

                                                                                      modifyOption: <A, B extends A = A>(
                                                                                      f: (a: A) => B
                                                                                      ) => <S>(sa: Prism<S, A>) => (s: S) => Option<S>;
                                                                                      • combinators 2.3.0

                                                                                      function prism

                                                                                      prism: <S, A>(
                                                                                      getOption: (s: S) => Option<A>,
                                                                                      reverseGet: (a: A) => S
                                                                                      ) => Prism<S, A>;
                                                                                      • constructors 2.3.8

                                                                                      function prop

                                                                                      prop: <A, P extends keyof A>(
                                                                                      prop: P
                                                                                      ) => <S>(sa: Prism<S, A>) => Optional<S, A[P]>;
                                                                                      • Return a Optional from a Prism and a prop.

                                                                                        combinators 2.3.0

                                                                                      function props

                                                                                      props: <A, P extends keyof A>(
                                                                                      props_0: P,
                                                                                      props_1: P,
                                                                                      ...props_2: P[]
                                                                                      ) => <S>(sa: Prism<S, A>) => Optional<S, { [K in P]: A[K] }>;
                                                                                      • Return a Optional from a Prism and a list of props.

                                                                                        combinators 2.3.0

                                                                                      function right

                                                                                      right: <S, E, A>(sea: Prism<S, Either<E, A>>) => Prism<S, A>;
                                                                                      • Return a Prism from a Prism focused on the Right of a Either type.

                                                                                        combinators 2.3.0

                                                                                      function set

                                                                                      set: <A>(a: A) => <S>(sa: Prism<S, A>) => (s: S) => S;
                                                                                      • combinators 2.3.0

                                                                                      function some

                                                                                      some: <S, A>(soa: Prism<S, Option<A>>) => Prism<S, A>;
                                                                                      • Return a Prism from a Prism focused on the Some of a Option type.

                                                                                        combinators 2.3.0

                                                                                      function traverse

                                                                                      traverse: <T extends URIS>(
                                                                                      T: Traversable1<T>
                                                                                      ) => <S, A>(sta: Prism<S, Kind<T, A>>) => Traversal<S, A>;
                                                                                      • Return a Traversal from a Prism focused on a Traversable.

                                                                                        combinators 2.3.0

                                                                                      interface Prism

                                                                                      interface Prism<S, A> {}
                                                                                      • model 2.3.0

                                                                                      property getOption

                                                                                      readonly getOption: (s: S) => Option<A>;

                                                                                        property reverseGet

                                                                                        readonly reverseGet: (a: A) => S;

                                                                                          type URI

                                                                                          type URI = typeof URI;
                                                                                          • instances 2.3.0

                                                                                          namespace traversal

                                                                                          module 'lib/Traversal.d.ts' {}
                                                                                          • **This module is experimental**

                                                                                            Experimental features are published in order to get early feedback from the community.

                                                                                            A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.

                                                                                            A Traversal is the generalisation of an Optional to several targets. In other word, a Traversal allows to focus from a type S into 0 to n values of type A.

                                                                                            The most common example of a Traversal would be to focus into all elements inside of a container (e.g. ReadonlyArray, Option). To do this we will use the relation between the typeclass Traversable and Traversal.

                                                                                            2.3.0

                                                                                          variable Category

                                                                                          const Category: Category2<'monocle-ts/Traversal'>;
                                                                                          • instances 2.3.0

                                                                                          variable fromTraversable

                                                                                          const fromTraversable: {
                                                                                          <T extends URIS3>(T: Traversable3<T>): <R, E, A>() => Traversal<
                                                                                          Kind3<T, R, E, A>,
                                                                                          A
                                                                                          >;
                                                                                          <T extends URIS2>(T: Traversable2<T>): <E, A>() => Traversal<