Socket
Socket
Sign inDemoInstall

monocle-ts

Package Overview
Dependencies
1
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

5

CHANGELOG.md

@@ -16,2 +16,7 @@ # Changelog

# 2.0.1
- **Bug Fix**
- rewrite es6 imports (@gcanti)
# 2.0.0

@@ -18,0 +23,0 @@

8

es6/At/Record.d.ts

@@ -0,3 +1,9 @@

/**
* @since 1.7.0
*/
import { At } from '../index';
import { Option } from 'fp-ts/lib/Option';
import { Option } from 'fp-ts/es6/Option';
/**
* @since 1.7.0
*/
export declare function atRecord<A = never>(): At<Record<string, A>, string, Option<A>>;

10

es6/At/Record.js

@@ -0,4 +1,10 @@

/**
* @since 1.7.0
*/
import { At, Lens } from '../index';
import { isNone } from 'fp-ts/lib/Option';
import * as R from 'fp-ts/lib/Record';
import { isNone } from 'fp-ts/es6/Option';
import * as R from 'fp-ts/es6/Record';
/**
* @since 1.7.0
*/
export function atRecord() {

@@ -5,0 +11,0 @@ return new At(function (k) {

@@ -0,3 +1,9 @@

/**
* @since 1.2.0
*/
import { At } from '../index';
import { Eq } from 'fp-ts/lib/Eq';
import { Eq } from 'fp-ts/es6/Eq';
/**
* @since 1.2.0
*/
export declare function atSet<A = never>(E: Eq<A>): At<Set<A>, A, boolean>;

@@ -0,3 +1,9 @@

/**
* @since 1.2.0
*/
import { At, Lens } from '../index';
import * as S from 'fp-ts/lib/Set';
import * as S from 'fp-ts/es6/Set';
/**
* @since 1.2.0
*/
export function atSet(E) {

@@ -4,0 +10,0 @@ var elemE = S.elem(E);

@@ -1,4 +0,13 @@

import { Either } from 'fp-ts/lib/Either';
/**
* @since 1.6.0
*/
import { Either } from 'fp-ts/es6/Either';
import { Prism } from '.';
/**
* @since 1.6.0
*/
export declare const _right: <L, A>() => Prism<Either<L, A>, A>;
/**
* @since 1.6.0
*/
export declare const _left: <L, A>() => Prism<Either<L, A>, L>;

@@ -1,7 +0,16 @@

import { right, left, fold } from 'fp-ts/lib/Either';
import { fromEither, none, some } from 'fp-ts/lib/Option';
/**
* @since 1.6.0
*/
import { right, left, fold } from 'fp-ts/es6/Either';
import { fromEither, none, some } from 'fp-ts/es6/Option';
import { Prism } from '.';
var r = new Prism(fromEither, right);
/**
* @since 1.6.0
*/
export var _right = function () { return r; };
var l = new Prism(fold(some, function () { return none; }), left);
/**
* @since 1.6.0
*/
export var _left = function () { return l; };

@@ -1,8 +0,18 @@

import { HKT, URIS, URIS2, URIS3, Kind3, Kind2, Kind } from 'fp-ts/lib/HKT';
import { Monoid } from 'fp-ts/lib/Monoid';
import { Applicative, Applicative1, Applicative2, Applicative3, Applicative2C } from 'fp-ts/lib/Applicative';
import { Foldable, Foldable1, Foldable2, Foldable3 } from 'fp-ts/lib/Foldable';
import { Traversable, Traversable1, Traversable2, Traversable3 } from 'fp-ts/lib/Traversable';
import { Option } from 'fp-ts/lib/Option';
import { Predicate, Refinement } from 'fp-ts/lib/function';
/**
* @since 1.0.0
*/
import { HKT, URIS, URIS2, URIS3, Kind3, Kind2, Kind } from 'fp-ts/es6/HKT';
import { Monoid } from 'fp-ts/es6/Monoid';
import { Applicative, Applicative1, Applicative2, Applicative3, Applicative2C } from 'fp-ts/es6/Applicative';
import { Foldable, Foldable1, Foldable2, Foldable3 } from 'fp-ts/es6/Foldable';
import { Traversable, Traversable1, Traversable2, Traversable3 } from 'fp-ts/es6/Traversable';
import { Option } from 'fp-ts/es6/Option';
import { Predicate, Refinement } from 'fp-ts/es6/function';
/**
* Laws:
* 1. reverseGet(get(s)) = s
* 2. get(reversetGet(a)) = a
*
* @since 1.0.0
*/
export declare class Iso<S, A> {

@@ -17,38 +27,111 @@ readonly get: (s: S) => A;

constructor(get: (s: S) => A, reverseGet: (a: A) => S);
/** reverse the `Iso`: the source becomes the target and the target becomes the source */
/**
* reverse the `Iso`: the source becomes the target and the target becomes the source
* @since 1.0.0
*/
reverse(): Iso<A, S>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/** view an Iso as a Lens */
/**
* view an `Iso` as a `Lens`
*
* @since 1.0.0
*/
asLens(): Lens<S, A>;
/** view an Iso as a Prism */
/**
* view an `Iso` as a `Prism`
*
* @since 1.0.0
*/
asPrism(): Prism<S, A>;
/** view an Iso as a Optional */
/**
* view an `Iso` as a `Optional`
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view an Iso as a Traversal */
/**
* view an `Iso` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view an Iso as a Fold */
/**
* view an `Iso` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view an Iso as a Getter */
/**
* view an `Iso` as a `Getter`
*
* @since 1.0.0
*/
asGetter(): Getter<S, A>;
/** view an Iso as a Setter */
/**
* view an `Iso` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose an Iso with an Iso */
/**
* compose an `Iso` with an `Iso`
*
* @since 1.0.0
*/
compose<B>(ab: Iso<A, B>): Iso<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Iso<S, B>;
/** compose an Iso with a Lens */
/**
* compose an `Iso` with a `Lens `
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Lens<S, B>;
/** compose an Iso with a Prism */
/**
* compose an `Iso` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Prism<S, B>;
/** compose an Iso with an Optional */
/**
* compose an `Iso` with an `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose an Iso with a Traversal */
/**
* compose an `Iso` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose an Iso with a Fold */
/**
* compose an `Iso` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose an Iso with a Getter */
/**
* compose an `Iso` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose an Iso with a Setter */
/**
* compose an `Iso` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
}
/**
* @since 1.3.0
*/
export interface LensFromPath<S> {

@@ -61,2 +144,10 @@ <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]>;

}
/**
* Laws:
* 1. get(set(a)(s)) = a
* 2. set(get(s))(s) = s
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
export declare class Lens<S, A> {

@@ -85,2 +176,4 @@ readonly get: (s: S) => A;

* assert.deepStrictEqual(city.set('London')(person), { name: 'Giulio', age: 43, address: { city: 'London' } })
*
* @since 1.0.0
*/

@@ -105,6 +198,8 @@ static fromPath<S>(): LensFromPath<S>;

* assert.deepStrictEqual(age.set(44)(person), { name: 'Giulio', age: 44 })
*
* @since 1.0.0
*/
static fromProp<S>(): <P extends keyof S>(prop: P) => Lens<S, S[P]>;
/**
* generate a lens from a type and an array of props
* generate a `Lens` from a type and an array of props
*

@@ -126,2 +221,4 @@ * @example

* assert.deepStrictEqual(lens.set({ name: 'Guido', age: 47 })(person), { name: 'Guido', age: 47, rememberMe: true })
*
* @since 1.0.0
*/

@@ -132,3 +229,3 @@ static fromProps<S>(): <P extends keyof S>(props: Array<P>) => Lens<S, {

/**
* generate a lens from a type and a prop whose type is nullable
* generate a `Lens` from a type and a prop whose type is nullable
*

@@ -155,34 +252,102 @@ * @example

* assert.strictEqual(lens.get({ inner: { value: 1, foo: 'bar' } })), 1)
*
* @since 1.0.0
*/
static fromNullableProp<S>(): <A extends S[K], K extends keyof S>(k: K, defaultValue: A) => Lens<S, NonNullable<S[K]>>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/** view a Lens as a Optional */
/**
* view a `Lens` as a Optional
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view a Lens as a Traversal */
/**
* view a `Lens` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view a Lens as a Setter */
/**
* view a `Lens` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** view a Lens as a Getter */
/**
* view a `Lens` as a `Getter`
*
* @since 1.0.0
*/
asGetter(): Getter<S, A>;
/** view a Lens as a Fold */
/**
* view a `Lens` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Lens with a Lens */
/**
* compose a `Lens` with a `Lens`
*
* @since 1.0.0
*/
compose<B>(ab: Lens<A, B>): Lens<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Lens<S, B>;
/** compose a Lens with a Getter */
/**
* compose a `Lens` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose a Lens with a Fold */
/**
* compose a `Lens` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Lens with an Optional */
/**
* compose a `Lens` with an `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose a Lens with an Traversal */
/**
* compose a `Lens` with an `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Lens with an Setter */
/**
* compose a `Lens` with an `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Lens with an Iso */
/**
* compose a `Lens` with an `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Lens<S, B>;
/** compose a Lens with a Prism */
/**
* compose a `Lens` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Optional<S, B>;
}
/**
* Laws:
* 1. getOption(s).fold(s, reverseGet) = s
* 2. getOption(reverseGet(a)) = Some(a)
*
* @since 1.0.0
*/
export declare class Prism<S, A> {

@@ -193,34 +358,102 @@ readonly getOption: (s: S) => Option<A>;

constructor(getOption: (s: S) => Option<A>, reverseGet: (a: A) => S);
/**
* @since 1.0.0
*/
static fromPredicate<S, A extends S>(refinement: Refinement<S, A>): Prism<S, A>;
static fromPredicate<A>(predicate: Predicate<A>): Prism<A, A>;
/**
* @since 1.0.0
*/
static some<A>(): Prism<Option<A>, A>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
modifyOption(f: (a: A) => A): (s: S) => Option<S>;
/** set the target of a Prism with a value */
/**
* set the target of a `Prism` with a value
*
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/** view a Prism as a Optional */
/**
* view a `Prism` as a `Optional`
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view a Prism as a Traversal */
/**
* view a `Prism` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view a Prism as a Setter */
/**
* view a `Prism` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** view a Prism as a Fold */
/**
* view a `Prism` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Prism with a Prism */
/**
* compose a `Prism` with a `Prism`
*
* @since 1.0.0
*/
compose<B>(ab: Prism<A, B>): Prism<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Prism<S, B>;
/** compose a Prism with a Optional */
/**
* compose a `Prism` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose a Prism with a Traversal */
/**
* compose a `Prism` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Prism with a Fold */
/**
* compose a `Prism` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Prism with a Setter */
/**
* compose a `Prism` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Prism with a Iso */
/**
* compose a `Prism` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Prism<S, B>;
/** compose a Prism with a Lens */
/**
* compose a `Prism` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Optional<S, B>;
/** compose a Prism with a Getter */
/**
* compose a `Prism` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;

@@ -232,2 +465,10 @@ }

declare type OptionPropertyType<S, K extends OptionPropertyNames<S>> = S[K] extends Option<infer A> ? A : never;
/**
* Laws:
* 1. getOption(s).fold(() => s, a => set(a)(s)) = s
* 2. getOption(set(a)(s)) = getOption(s).map(_ => a)
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
export declare class Optional<S, A> {

@@ -281,2 +522,4 @@ readonly getOption: (s: S) => Option<A>;

* numberFromResponse.getOption(response2) // none
*
* @since 1.0.0
*/

@@ -287,3 +530,3 @@ static fromNullableProp<S>(): <K extends keyof S>(k: K) => Optional<S, NonNullable<S[K]>>;

* import { Optional, Lens } from 'monocle-ts'
* import { Option } from 'fp-ts/lib/Option'
* import { Option } from 'fp-ts/es6/Option'
*

@@ -311,31 +554,90 @@ * interface Phone {

* .composeLens(number)
*
* @since 1.0.0
*/
static fromOptionProp<S>(): <P extends OptionPropertyNames<S>>(prop: P) => Optional<S, OptionPropertyType<S, P>>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
modifyOption(f: (a: A) => A): (s: S) => Option<S>;
/** view a Optional as a Traversal */
/**
* view a `Optional` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view an Optional as a Fold */
/**
* view an `Optional` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view an Optional as a Setter */
/**
* view an `Optional` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose a Optional with a Optional */
/**
* compose a `Optional` with a `Optional`
*
* @since 1.0.0
*/
compose<B>(ab: Optional<A, B>): Optional<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose an Optional with a Traversal */
/**
* compose an `Optional` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose an Optional with a Fold */
/**
* compose an `Optional` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose an Optional with a Setter */
/**
* compose an `Optional` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose an Optional with a Lens */
/**
* compose an `Optional` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Optional<S, B>;
/** compose an Optional with a Prism */
/**
* compose an `Optional` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Optional<S, B>;
/** compose an Optional with a Iso */
/**
* compose an `Optional` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Optional<S, B>;
/** compose an Optional with a Getter */
/**
* compose an `Optional` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
}
/**
* @since 1.0.0
*/
export interface ModifyF<S, A> {

@@ -348,2 +650,5 @@ <F extends URIS3>(F: Applicative3<F>): <U, L>(f: (a: A) => Kind3<F, U, L, A>) => (s: S) => Kind3<F, U, L, S>;

}
/**
* @since 1.0.0
*/
export declare class Traversal<S, A> {

@@ -353,10 +658,16 @@ readonly modifyF: ModifyF<S, A>;

constructor(modifyF: ModifyF<S, A>);
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/**
* focus the items matched by a traversal to those that match a predicate
* focus the items matched by a `traversal` to those that match a predicate
*
* @example
* import { fromTraversable, Lens } from 'monocle-ts'
* import { array } from 'fp-ts/lib/Array'
* import { array } from 'fp-ts/es6/Array'
*

@@ -376,28 +687,77 @@ * interface Person {

* assert.deepStrictEqual(actual, [{name: 'bill', cool: true}, {name: 'jill', cool: true}])
*
* @since 1.0.0
*/
filter<B extends A>(refinement: Refinement<A, B>): Traversal<S, B>;
filter(predicate: Predicate<A>): Traversal<S, A>;
/** view a Traversal as a Fold */
/**
* view a `Traversal` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view a Traversal as a Setter */
/**
* view a `Traversal` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose a Traversal with a Traversal */
/**
* compose a `Traversal` with a `Traversal`
*
* @since 1.0.0
*/
compose<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Traversal with a Fold */
/**
* compose a `Traversal` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Traversal with a Setter */
/**
* compose a `Traversal` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Traversal with a Optional */
/**
* compose a `Traversal` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Traversal<S, B>;
/** compose a Traversal with a Lens */
/**
* compose a `Traversal` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Traversal<S, B>;
/** compose a Traversal with a Prism */
/**
* compose a `Traversal` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Traversal<S, B>;
/** compose a Traversal with a Iso */
/**
* compose a `Traversal` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Traversal<S, B>;
/** compose a Traversal with a Getter */
/**
* compose a `Traversal` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
}
/**
* @since 1.2.0
*/
export declare class At<S, I, A> {

@@ -407,5 +767,12 @@ readonly at: (i: I) => Lens<S, A>;

constructor(at: (i: I) => Lens<S, A>);
/** lift an instance of `At` using an `Iso` */
/**
* lift an instance of `At` using an `Iso`
*
* @since 1.2.0
*/
fromIso<T>(iso: Iso<T, S>): At<T, I, A>;
}
/**
* @since 1.2.0
*/
export declare class Index<S, I, A> {

@@ -415,6 +782,16 @@ readonly index: (i: I) => Optional<S, A>;

constructor(index: (i: I) => Optional<S, A>);
/**
* @since 1.2.0
*/
static fromAt<T, J, B>(at: At<T, J, Option<B>>): Index<T, J, B>;
/** lift an instance of `Index` using an `Iso` */
/**
* lift an instance of `Index` using an `Iso`
*
* @since 1.2.0
*/
fromIso<T>(iso: Iso<T, S>): Index<T, I, A>;
}
/**
* @since 1.0.0
*/
export declare class Getter<S, A> {

@@ -424,54 +801,148 @@ readonly get: (s: S) => A;

constructor(get: (s: S) => A);
/** view a Getter as a Fold */
/**
* view a `Getter` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Getter with a Getter */
/**
* compose a `Getter` with a `Getter`
*
* @since 1.0.0
*/
compose<B>(ab: Getter<A, B>): Getter<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose a Getter with a Fold */
/**
* compose a `Getter` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Getter with a Lens */
/**
* compose a `Getter` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Getter<S, B>;
/** compose a Getter with a Iso */
/**
* compose a `Getter` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Getter<S, B>;
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Fold<S, B>;
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Fold<S, B>;
/** compose a Getter with a Prism */
/**
* compose a `Getter` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Fold<S, B>;
}
/**
* @since 1.0.0
*/
export declare class Fold<S, A> {
readonly foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M;
readonly _tag: 'Fold';
/** get all the targets of a Fold */
/**
* get all the targets of a `Fold`
*
* @since 1.0.0
*/
readonly getAll: (s: S) => Array<A>;
/** check if at least one target satisfies the predicate */
/**
* check if at least one target satisfies the predicate
*
* @since 1.0.0
*/
readonly exist: (p: Predicate<A>) => Predicate<S>;
/** check if all targets satisfy the predicate */
/**
* check if all targets satisfy the predicate
*
* @since 1.0.0
*/
readonly all: (p: Predicate<A>) => Predicate<S>;
private foldMapFirst;
constructor(foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M);
/** compose a Fold with a Fold */
/**
* compose a `Fold` with a `Fold`
*
* @since 1.0.0
*/
compose<B>(ab: Fold<A, B>): Fold<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Fold with a Getter */
/**
* compose a `Fold` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
/** compose a Fold with a Traversal */
/**
* compose a `Fold` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Fold<S, B>;
/** compose a Fold with a Optional */
/**
* compose a `Fold` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Fold<S, B>;
/** compose a Fold with a Lens */
/**
* compose a `Fold` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Fold<S, B>;
/** compose a Fold with a Prism */
/**
* compose a `Fold` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Fold<S, B>;
/** compose a Fold with a Iso */
/**
* compose a `Fold` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Fold<S, B>;
/** find the first target of a Fold matching the predicate */
/**
* find the first target of a `Fold` matching the predicate
*
* @since 1.0.0
*/
find<B extends A>(p: Refinement<A, B>): (s: S) => Option<B>;
find(p: Predicate<A>): (s: S) => Option<A>;
/** get the first target of a Fold */
/**
* get the first target of a `Fold`
*
* @since 1.0.0
*/
headOption(s: S): Option<A>;
}
/**
* @since 1.0.0
*/
export declare class Setter<S, A> {

@@ -481,24 +952,55 @@ readonly modify: (f: (a: A) => A) => (s: S) => S;

constructor(modify: (f: (a: A) => A) => (s: S) => S);
/**
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/** compose a Setter with a Setter */
/**
* compose a `Setter` with a `Setter`
*
* @since 1.0.0
*/
compose<B>(ab: Setter<A, B>): Setter<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Setter with a Traversal */
/**
* compose a `Setter` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Setter<S, B>;
/** compose a Setter with a Optional */
/**
* compose a `Setter` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Setter<S, B>;
/** compose a Setter with a Lens */
/**
* compose a `Setter` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Setter<S, B>;
/** compose a Setter with a Prism */
/**
* compose a `Setter` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Setter<S, B>;
/** compose a Setter with a Iso */
/**
* compose a `Setter` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Setter<S, B>;
}
/**
* create a Traversal from a Traversable
* create a `Traversal` from a `Traversable`
*
* @example
* import { Lens, fromTraversable } from 'monocle-ts'
* import { array } from 'fp-ts/lib/Array'
* import { array } from 'fp-ts/es6/Array'
*

@@ -530,2 +1032,4 @@ * interface Tweet {

* assert.deepStrictEqual(actual, { tweets: [ { text: 'dlrow olleh' }, { text: 'raboof' } ] })
*
* @since 1.0.0
*/

@@ -536,3 +1040,7 @@ export declare function fromTraversable<T extends URIS3>(T: Traversable3<T>): <U, L, A>() => Traversal<Kind3<T, U, L, A>, A>;

export declare function fromTraversable<T>(T: Traversable<T>): <A>() => Traversal<HKT<T, A>, A>;
/** create a Fold from a Foldable */
/**
* create a `Fold` from a `Foldable`
*
* @since 1.0.0
*/
export declare function fromFoldable<F extends URIS3>(F: Foldable3<F>): <U, L, A>() => Fold<Kind3<F, U, L, A>, A>;

@@ -539,0 +1047,0 @@ export declare function fromFoldable<F extends URIS2>(F: Foldable2<F>): <L, A>() => Fold<Kind2<F, L, A>, A>;

@@ -1,7 +0,7 @@

import { monoidAll, monoidAny } from 'fp-ts/lib/Monoid';
import { none, some, fromNullable, getFirstMonoid, fromPredicate, isNone, option } from 'fp-ts/lib/Option';
import { identity, constant } from 'fp-ts/lib/function';
import { identity as id } from 'fp-ts/lib/Identity';
import { getApplicative, make } from 'fp-ts/lib/Const';
import { getMonoid } from 'fp-ts/lib/Array';
import { monoidAll, monoidAny } from 'fp-ts/es6/Monoid';
import { none, some, fromNullable, getFirstMonoid, fromPredicate, isNone, option } from 'fp-ts/es6/Option';
import { identity, constant } from 'fp-ts/es6/function';
import { identity as id } from 'fp-ts/es6/Identity';
import { getApplicative, make } from 'fp-ts/es6/Const';
import { getMonoid } from 'fp-ts/es6/Array';
var update = function (o, k, a) {

@@ -11,7 +11,9 @@ var _a;

};
/*
Laws:
1. reverseGet(get(s)) = s
2. get(reversetGet(a)) = a
*/
/**
* Laws:
* 1. reverseGet(get(s)) = s
* 2. get(reversetGet(a)) = a
*
* @since 1.0.0
*/
var Iso = /** @class */ (function () {

@@ -27,6 +29,12 @@ function Iso(get, reverseGet) {

}
/** reverse the `Iso`: the source becomes the target and the target becomes the source */
/**
* reverse the `Iso`: the source becomes the target and the target becomes the source
* @since 1.0.0
*/
Iso.prototype.reverse = function () {
return new Iso(this.reverseGet, this.get);
};
/**
* @since 1.0.0
*/
Iso.prototype.modify = function (f) {

@@ -36,3 +44,7 @@ var _this = this;

};
/** view an Iso as a Lens */
/**
* view an `Iso` as a `Lens`
*
* @since 1.0.0
*/
Iso.prototype.asLens = function () {

@@ -42,3 +54,7 @@ var _this = this;

};
/** view an Iso as a Prism */
/**
* view an `Iso` as a `Prism`
*
* @since 1.0.0
*/
Iso.prototype.asPrism = function () {

@@ -48,3 +64,7 @@ var _this = this;

};
/** view an Iso as a Optional */
/**
* view an `Iso` as a `Optional`
*
* @since 1.0.0
*/
Iso.prototype.asOptional = function () {

@@ -54,3 +74,7 @@ var _this = this;

};
/** view an Iso as a Traversal */
/**
* view an `Iso` as a `Traversal`
*
* @since 1.0.0
*/
Iso.prototype.asTraversal = function () {

@@ -62,3 +86,7 @@ var _this = this;

};
/** view an Iso as a Fold */
/**
* view an `Iso` as a `Fold`
*
* @since 1.0.0
*/
Iso.prototype.asFold = function () {

@@ -68,3 +96,7 @@ var _this = this;

};
/** view an Iso as a Getter */
/**
* view an `Iso` as a `Getter`
*
* @since 1.0.0
*/
Iso.prototype.asGetter = function () {

@@ -74,3 +106,7 @@ var _this = this;

};
/** view an Iso as a Setter */
/**
* view an `Iso` as a `Setter`
*
* @since 1.0.0
*/
Iso.prototype.asSetter = function () {

@@ -80,3 +116,7 @@ var _this = this;

};
/** compose an Iso with an Iso */
/**
* compose an `Iso` with an `Iso`
*
* @since 1.0.0
*/
Iso.prototype.compose = function (ab) {

@@ -86,31 +126,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Iso.prototype.composeIso = function (ab) {
return this.compose(ab);
};
/** compose an Iso with a Lens */
/**
* compose an `Iso` with a `Lens `
*
* @since 1.0.0
*/
Iso.prototype.composeLens = function (ab) {
return this.asLens().compose(ab);
};
/** compose an Iso with a Prism */
/**
* compose an `Iso` with a `Prism`
*
* @since 1.0.0
*/
Iso.prototype.composePrism = function (ab) {
return this.asPrism().compose(ab);
};
/** compose an Iso with an Optional */
/**
* compose an `Iso` with an `Optional`
*
* @since 1.0.0
*/
Iso.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose an Iso with a Traversal */
/**
* compose an `Iso` with a `Traversal`
*
* @since 1.0.0
*/
Iso.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose an Iso with a Fold */
/**
* compose an `Iso` with a `Fold`
*
* @since 1.0.0
*/
Iso.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose an Iso with a Getter */
/**
* compose an `Iso` with a `Getter`
*
* @since 1.0.0
*/
Iso.prototype.composeGetter = function (ab) {
return this.asGetter().compose(ab);
};
/** compose an Iso with a Setter */
/**
* compose an `Iso` with a `Setter`
*
* @since 1.0.0
*/
Iso.prototype.composeSetter = function (ab) {

@@ -122,8 +194,10 @@ return this.asSetter().compose(ab);

export { Iso };
/*
Laws:
1. get(set(a)(s)) = a
2. set(get(s))(s) = s
3. set(a)(set(a)(s)) = set(a)(s)
*/
/**
* Laws:
* 1. get(set(a)(s)) = a
* 2. set(get(s))(s) = s
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
var Lens = /** @class */ (function () {

@@ -153,2 +227,4 @@ function Lens(get, set) {

* assert.deepStrictEqual(city.set('London')(person), { name: 'Giulio', age: 43, address: { city: 'London' } })
*
* @since 1.0.0
*/

@@ -179,2 +255,4 @@ Lens.fromPath = function () {

* assert.deepStrictEqual(age.set(44)(person), { name: 'Giulio', age: 44 })
*
* @since 1.0.0
*/

@@ -185,3 +263,3 @@ Lens.fromProp = function () {

/**
* generate a lens from a type and an array of props
* generate a `Lens` from a type and an array of props
*

@@ -203,2 +281,4 @@ * @example

* assert.deepStrictEqual(lens.set({ name: 'Guido', age: 47 })(person), { name: 'Guido', age: 47, rememberMe: true })
*
* @since 1.0.0
*/

@@ -227,3 +307,3 @@ Lens.fromProps = function () {

/**
* generate a lens from a type and a prop whose type is nullable
* generate a `Lens` from a type and a prop whose type is nullable
*

@@ -250,2 +330,4 @@ * @example

* assert.strictEqual(lens.get({ inner: { value: 1, foo: 'bar' } })), 1)
*
* @since 1.0.0
*/

@@ -265,2 +347,5 @@ Lens.fromNullableProp = function () {

};
/**
* @since 1.0.0
*/
Lens.prototype.modify = function (f) {

@@ -274,3 +359,7 @@ var _this = this;

};
/** view a Lens as a Optional */
/**
* view a `Lens` as a Optional
*
* @since 1.0.0
*/
Lens.prototype.asOptional = function () {

@@ -280,3 +369,7 @@ var _this = this;

};
/** view a Lens as a Traversal */
/**
* view a `Lens` as a `Traversal`
*
* @since 1.0.0
*/
Lens.prototype.asTraversal = function () {

@@ -288,3 +381,7 @@ var _this = this;

};
/** view a Lens as a Setter */
/**
* view a `Lens` as a `Setter`
*
* @since 1.0.0
*/
Lens.prototype.asSetter = function () {

@@ -294,3 +391,7 @@ var _this = this;

};
/** view a Lens as a Getter */
/**
* view a `Lens` as a `Getter`
*
* @since 1.0.0
*/
Lens.prototype.asGetter = function () {

@@ -300,3 +401,7 @@ var _this = this;

};
/** view a Lens as a Fold */
/**
* view a `Lens` as a `Fold`
*
* @since 1.0.0
*/
Lens.prototype.asFold = function () {

@@ -306,3 +411,7 @@ var _this = this;

};
/** compose a Lens with a Lens */
/**
* compose a `Lens` with a `Lens`
*
* @since 1.0.0
*/
Lens.prototype.compose = function (ab) {

@@ -312,31 +421,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Lens.prototype.composeLens = function (ab) {
return this.compose(ab);
};
/** compose a Lens with a Getter */
/**
* compose a `Lens` with a `Getter`
*
* @since 1.0.0
*/
Lens.prototype.composeGetter = function (ab) {
return this.asGetter().compose(ab);
};
/** compose a Lens with a Fold */
/**
* compose a `Lens` with a `Fold`
*
* @since 1.0.0
*/
Lens.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Lens with an Optional */
/**
* compose a `Lens` with an `Optional`
*
* @since 1.0.0
*/
Lens.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose a Lens with an Traversal */
/**
* compose a `Lens` with an `Traversal`
*
* @since 1.0.0
*/
Lens.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose a Lens with an Setter */
/**
* compose a `Lens` with an `Setter`
*
* @since 1.0.0
*/
Lens.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Lens with an Iso */
/**
* compose a `Lens` with an `Iso`
*
* @since 1.0.0
*/
Lens.prototype.composeIso = function (ab) {
return this.compose(ab.asLens());
};
/** compose a Lens with a Prism */
/**
* compose a `Lens` with a `Prism`
*
* @since 1.0.0
*/
Lens.prototype.composePrism = function (ab) {

@@ -348,7 +489,9 @@ return this.asOptional().compose(ab.asOptional());

export { Lens };
/*
Laws:
1. getOption(s).fold(s, reverseGet) = s
2. getOption(reverseGet(a)) = Some(a)
*/
/**
* Laws:
* 1. getOption(s).fold(s, reverseGet) = s
* 2. getOption(reverseGet(a)) = Some(a)
*
* @since 1.0.0
*/
var Prism = /** @class */ (function () {

@@ -363,5 +506,11 @@ function Prism(getOption, reverseGet) {

};
/**
* @since 1.0.0
*/
Prism.some = function () {
return somePrism;
};
/**
* @since 1.0.0
*/
Prism.prototype.modify = function (f) {

@@ -379,2 +528,5 @@ var _this = this;

};
/**
* @since 1.0.0
*/
Prism.prototype.modifyOption = function (f) {

@@ -389,7 +541,15 @@ var _this = this;

};
/** set the target of a Prism with a value */
/**
* set the target of a `Prism` with a value
*
* @since 1.0.0
*/
Prism.prototype.set = function (a) {
return this.modify(function () { return a; });
};
/** view a Prism as a Optional */
/**
* view a `Prism` as a `Optional`
*
* @since 1.0.0
*/
Prism.prototype.asOptional = function () {

@@ -399,3 +559,7 @@ var _this = this;

};
/** view a Prism as a Traversal */
/**
* view a `Prism` as a `Traversal`
*
* @since 1.0.0
*/
Prism.prototype.asTraversal = function () {

@@ -413,3 +577,7 @@ var _this = this;

};
/** view a Prism as a Setter */
/**
* view a `Prism` as a `Setter`
*
* @since 1.0.0
*/
Prism.prototype.asSetter = function () {

@@ -419,3 +587,7 @@ var _this = this;

};
/** view a Prism as a Fold */
/**
* view a `Prism` as a `Fold`
*
* @since 1.0.0
*/
Prism.prototype.asFold = function () {

@@ -433,3 +605,7 @@ var _this = this;

};
/** compose a Prism with a Prism */
/**
* compose a `Prism` with a `Prism`
*
* @since 1.0.0
*/
Prism.prototype.compose = function (ab) {

@@ -439,31 +615,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Prism.prototype.composePrism = function (ab) {
return this.compose(ab);
};
/** compose a Prism with a Optional */
/**
* compose a `Prism` with a `Optional`
*
* @since 1.0.0
*/
Prism.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose a Prism with a Traversal */
/**
* compose a `Prism` with a `Traversal`
*
* @since 1.0.0
*/
Prism.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose a Prism with a Fold */
/**
* compose a `Prism` with a `Fold`
*
* @since 1.0.0
*/
Prism.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Prism with a Setter */
/**
* compose a `Prism` with a `Setter`
*
* @since 1.0.0
*/
Prism.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Prism with a Iso */
/**
* compose a `Prism` with a `Iso`
*
* @since 1.0.0
*/
Prism.prototype.composeIso = function (ab) {
return this.compose(ab.asPrism());
};
/** compose a Prism with a Lens */
/**
* compose a `Prism` with a `Lens`
*
* @since 1.0.0
*/
Prism.prototype.composeLens = function (ab) {
return this.asOptional().compose(ab.asOptional());
};
/** compose a Prism with a Getter */
/**
* compose a `Prism` with a `Getter`
*
* @since 1.0.0
*/
Prism.prototype.composeGetter = function (ab) {

@@ -476,8 +684,10 @@ return this.asFold().compose(ab.asFold());

var somePrism = new Prism(identity, some);
/*
Laws:
1. getOption(s).fold(() => s, a => set(a)(s)) = s
2. getOption(set(a)(s)) = getOption(s).map(_ => a)
3. set(a)(set(a)(s)) = set(a)(s)
*/
/**
* Laws:
* 1. getOption(s).fold(() => s, a => set(a)(s)) = s
* 2. getOption(set(a)(s)) = getOption(s).map(_ => a)
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
var Optional = /** @class */ (function () {

@@ -532,2 +742,4 @@ function Optional(getOption, set) {

* numberFromResponse.getOption(response2) // none
*
* @since 1.0.0
*/

@@ -540,3 +752,3 @@ Optional.fromNullableProp = function () {

* import { Optional, Lens } from 'monocle-ts'
* import { Option } from 'fp-ts/lib/Option'
* import { Option } from 'fp-ts/es6/Option'
*

@@ -564,2 +776,4 @@ * interface Phone {

* .composeLens(number)
*
* @since 1.0.0
*/

@@ -570,2 +784,5 @@ Optional.fromOptionProp = function () {

};
/**
* @since 1.0.0
*/
Optional.prototype.modify = function (f) {

@@ -583,2 +800,5 @@ var _this = this;

};
/**
* @since 1.0.0
*/
Optional.prototype.modifyOption = function (f) {

@@ -593,3 +813,7 @@ var _this = this;

};
/** view a Optional as a Traversal */
/**
* view a `Optional` as a `Traversal`
*
* @since 1.0.0
*/
Optional.prototype.asTraversal = function () {

@@ -607,3 +831,7 @@ var _this = this;

};
/** view an Optional as a Fold */
/**
* view an `Optional` as a `Fold`
*
* @since 1.0.0
*/
Optional.prototype.asFold = function () {

@@ -621,3 +849,7 @@ var _this = this;

};
/** view an Optional as a Setter */
/**
* view an `Optional` as a `Setter`
*
* @since 1.0.0
*/
Optional.prototype.asSetter = function () {

@@ -627,3 +859,7 @@ var _this = this;

};
/** compose a Optional with a Optional */
/**
* compose a `Optional` with a `Optional`
*
* @since 1.0.0
*/
Optional.prototype.compose = function (ab) {

@@ -633,31 +869,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Optional.prototype.composeOptional = function (ab) {
return this.compose(ab);
};
/** compose an Optional with a Traversal */
/**
* compose an `Optional` with a `Traversal`
*
* @since 1.0.0
*/
Optional.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose an Optional with a Fold */
/**
* compose an `Optional` with a `Fold`
*
* @since 1.0.0
*/
Optional.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose an Optional with a Setter */
/**
* compose an `Optional` with a `Setter`
*
* @since 1.0.0
*/
Optional.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose an Optional with a Lens */
/**
* compose an `Optional` with a `Lens`
*
* @since 1.0.0
*/
Optional.prototype.composeLens = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Prism */
/**
* compose an `Optional` with a `Prism`
*
* @since 1.0.0
*/
Optional.prototype.composePrism = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Iso */
/**
* compose an `Optional` with a `Iso`
*
* @since 1.0.0
*/
Optional.prototype.composeIso = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Getter */
/**
* compose an `Optional` with a `Getter`
*
* @since 1.0.0
*/
Optional.prototype.composeGetter = function (ab) {

@@ -669,2 +937,5 @@ return this.asFold().compose(ab.asFold());

export { Optional };
/**
* @since 1.0.0
*/
var Traversal = /** @class */ (function () {

@@ -677,6 +948,11 @@ function Traversal(

}
/**
* @since 1.0.0
*/
Traversal.prototype.modify = function (f) {
var _this = this;
return function (s) { return _this.modifyF(id)(f)(s); };
return this.modifyF(id)(f);
};
/**
* @since 1.0.0
*/
Traversal.prototype.set = function (a) {

@@ -688,3 +964,7 @@ return this.modify(constant(a));

};
/** view a Traversal as a Fold */
/**
* view a `Traversal` as a `Fold`
*
* @since 1.0.0
*/
Traversal.prototype.asFold = function () {

@@ -694,3 +974,7 @@ var _this = this;

};
/** view a Traversal as a Setter */
/**
* view a `Traversal` as a `Setter`
*
* @since 1.0.0
*/
Traversal.prototype.asSetter = function () {

@@ -700,3 +984,7 @@ var _this = this;

};
/** compose a Traversal with a Traversal */
/**
* compose a `Traversal` with a `Traversal`
*
* @since 1.0.0
*/
Traversal.prototype.compose = function (ab) {

@@ -706,31 +994,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Traversal.prototype.composeTraversal = function (ab) {
return this.compose(ab);
};
/** compose a Traversal with a Fold */
/**
* compose a `Traversal` with a `Fold`
*
* @since 1.0.0
*/
Traversal.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Traversal with a Setter */
/**
* compose a `Traversal` with a `Setter`
*
* @since 1.0.0
*/
Traversal.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Traversal with a Optional */
/**
* compose a `Traversal` with a `Optional`
*
* @since 1.0.0
*/
Traversal.prototype.composeOptional = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Lens */
/**
* compose a `Traversal` with a `Lens`
*
* @since 1.0.0
*/
Traversal.prototype.composeLens = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Prism */
/**
* compose a `Traversal` with a `Prism`
*
* @since 1.0.0
*/
Traversal.prototype.composePrism = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Iso */
/**
* compose a `Traversal` with a `Iso`
*
* @since 1.0.0
*/
Traversal.prototype.composeIso = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Getter */
/**
* compose a `Traversal` with a `Getter`
*
* @since 1.0.0
*/
Traversal.prototype.composeGetter = function (ab) {

@@ -742,2 +1062,5 @@ return this.asFold().compose(ab.asFold());

export { Traversal };
/**
* @since 1.2.0
*/
var At = /** @class */ (function () {

@@ -748,3 +1071,7 @@ function At(at) {

}
/** lift an instance of `At` using an `Iso` */
/**
* lift an instance of `At` using an `Iso`
*
* @since 1.2.0
*/
At.prototype.fromIso = function (iso) {

@@ -757,2 +1084,5 @@ var _this = this;

export { At };
/**
* @since 1.2.0
*/
var Index = /** @class */ (function () {

@@ -763,6 +1093,13 @@ function Index(index) {

}
/**
* @since 1.2.0
*/
Index.fromAt = function (at) {
return new Index(function (i) { return at.at(i).composePrism(Prism.some()); });
};
/** lift an instance of `Index` using an `Iso` */
/**
* lift an instance of `Index` using an `Iso`
*
* @since 1.2.0
*/
Index.prototype.fromIso = function (iso) {

@@ -775,2 +1112,5 @@ var _this = this;

export { Index };
/**
* @since 1.0.0
*/
var Getter = /** @class */ (function () {

@@ -781,3 +1121,7 @@ function Getter(get) {

}
/** view a Getter as a Fold */
/**
* view a `Getter` as a `Fold`
*
* @since 1.0.0
*/
Getter.prototype.asFold = function () {

@@ -787,3 +1131,7 @@ var _this = this;

};
/** compose a Getter with a Getter */
/**
* compose a `Getter` with a `Getter`
*
* @since 1.0.0
*/
Getter.prototype.compose = function (ab) {

@@ -793,27 +1141,55 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Getter.prototype.composeGetter = function (ab) {
return this.compose(ab);
};
/** compose a Getter with a Fold */
/**
* compose a `Getter` with a `Fold`
*
* @since 1.0.0
*/
Getter.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Getter with a Lens */
/**
* compose a `Getter` with a `Lens`
*
* @since 1.0.0
*/
Getter.prototype.composeLens = function (ab) {
return this.compose(ab.asGetter());
};
/** compose a Getter with a Iso */
/**
* compose a `Getter` with a `Iso`
*
* @since 1.0.0
*/
Getter.prototype.composeIso = function (ab) {
return this.compose(ab.asGetter());
};
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
Getter.prototype.composeTraversal = function (ab) {
return this.asFold().compose(ab.asFold());
};
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
Getter.prototype.composeOptional = function (ab) {
return this.asFold().compose(ab.asFold());
};
/** compose a Getter with a Prism */
/**
* compose a `Getter` with a `Prism`
*
* @since 1.0.0
*/
Getter.prototype.composePrism = function (ab) {

@@ -825,2 +1201,5 @@ return this.asFold().compose(ab.asFold());

export { Getter };
/**
* @since 1.0.0
*/
var Fold = /** @class */ (function () {

@@ -835,3 +1214,7 @@ function Fold(foldMap) {

}
/** compose a Fold with a Fold */
/**
* compose a `Fold` with a `Fold`
*
* @since 1.0.0
*/
Fold.prototype.compose = function (ab) {

@@ -841,27 +1224,55 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Fold.prototype.composeFold = function (ab) {
return this.compose(ab);
};
/** compose a Fold with a Getter */
/**
* compose a `Fold` with a `Getter`
*
* @since 1.0.0
*/
Fold.prototype.composeGetter = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Traversal */
/**
* compose a `Fold` with a `Traversal`
*
* @since 1.0.0
*/
Fold.prototype.composeTraversal = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Optional */
/**
* compose a `Fold` with a `Optional`
*
* @since 1.0.0
*/
Fold.prototype.composeOptional = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Lens */
/**
* compose a `Fold` with a `Lens`
*
* @since 1.0.0
*/
Fold.prototype.composeLens = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Prism */
/**
* compose a `Fold` with a `Prism`
*
* @since 1.0.0
*/
Fold.prototype.composePrism = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Iso */
/**
* compose a `Fold` with a `Iso`
*
* @since 1.0.0
*/
Fold.prototype.composeIso = function (ab) {

@@ -873,3 +1284,7 @@ return this.compose(ab.asFold());

};
/** get the first target of a Fold */
/**
* get the first target of a `Fold`
*
* @since 1.0.0
*/
Fold.prototype.headOption = function (s) {

@@ -881,2 +1296,5 @@ return this.find(function () { return true; })(s);

export { Fold };
/**
* @since 1.0.0
*/
var Setter = /** @class */ (function () {

@@ -887,6 +1305,13 @@ function Setter(modify) {

}
/**
* @since 1.0.0
*/
Setter.prototype.set = function (a) {
return this.modify(constant(a));
};
/** compose a Setter with a Setter */
/**
* compose a `Setter` with a `Setter`
*
* @since 1.0.0
*/
Setter.prototype.compose = function (ab) {

@@ -896,23 +1321,47 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Setter.prototype.composeSetter = function (ab) {
return this.compose(ab);
};
/** compose a Setter with a Traversal */
/**
* compose a `Setter` with a `Traversal`
*
* @since 1.0.0
*/
Setter.prototype.composeTraversal = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Optional */
/**
* compose a `Setter` with a `Optional`
*
* @since 1.0.0
*/
Setter.prototype.composeOptional = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Lens */
/**
* compose a `Setter` with a `Lens`
*
* @since 1.0.0
*/
Setter.prototype.composeLens = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Prism */
/**
* compose a `Setter` with a `Prism`
*
* @since 1.0.0
*/
Setter.prototype.composePrism = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Iso */
/**
* compose a `Setter` with a `Iso`
*
* @since 1.0.0
*/
Setter.prototype.composeIso = function (ab) {

@@ -919,0 +1368,0 @@ return this.compose(ab.asSetter());

@@ -0,2 +1,8 @@

/**
* @since 1.2.0
*/
import { Index } from '../index';
/**
* @since 1.2.0
*/
export declare function indexArray<A = never>(): Index<Array<A>, number, A>;

@@ -0,4 +1,10 @@

/**
* @since 1.2.0
*/
import { Index, Optional } from '../index';
import { lookup, updateAt } from 'fp-ts/lib/Array';
import { isNone } from 'fp-ts/lib/Option';
import { lookup, updateAt } from 'fp-ts/es6/Array';
import { isNone } from 'fp-ts/es6/Option';
/**
* @since 1.2.0
*/
export function indexArray() {

@@ -5,0 +11,0 @@ return new Index(function (i) {

@@ -0,3 +1,9 @@

/**
* @since 1.5.0
*/
import { Index } from '../index';
import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray';
import { NonEmptyArray } from 'fp-ts/es6/NonEmptyArray';
/**
* @since 1.5.0
*/
export declare function indexNonEmptyArray<A = never>(): Index<NonEmptyArray<A>, number, A>;

@@ -0,5 +1,11 @@

/**
* @since 1.5.0
*/
import { Index, Optional } from '../index';
import { updateAt } from 'fp-ts/lib/NonEmptyArray';
import { lookup } from 'fp-ts/lib/Array';
import { isNone } from 'fp-ts/lib/Option';
import { updateAt } from 'fp-ts/es6/NonEmptyArray';
import { lookup } from 'fp-ts/es6/Array';
import { isNone } from 'fp-ts/es6/Option';
/**
* @since 1.5.0
*/
export function indexNonEmptyArray() {

@@ -6,0 +12,0 @@ return new Index(function (i) {

@@ -0,2 +1,8 @@

/**
* @since 1.7.0
*/
import { Index } from '../index';
/**
* @since 1.7.0
*/
export declare function indexRecord<A = never>(): Index<Record<string, A>, string, A>;

@@ -0,5 +1,11 @@

/**
* @since 1.7.0
*/
import { Index } from '../index';
import { atRecord } from '../At/Record';
/**
* @since 1.7.0
*/
export function indexRecord() {
return Index.fromAt(atRecord());
}

@@ -0,3 +1,9 @@

/**
* @since 1.7.0
*/
import { At } from '../index';
import { Option } from 'fp-ts/lib/Option';
/**
* @since 1.7.0
*/
export declare function atRecord<A = never>(): At<Record<string, A>, string, Option<A>>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.7.0
*/
var index_1 = require("../index");
var Option_1 = require("fp-ts/lib/Option");
var R = require("fp-ts/lib/Record");
/**
* @since 1.7.0
*/
function atRecord() {

@@ -7,0 +13,0 @@ return new index_1.At(function (k) {

@@ -0,3 +1,9 @@

/**
* @since 1.2.0
*/
import { At } from '../index';
import { Eq } from 'fp-ts/lib/Eq';
/**
* @since 1.2.0
*/
export declare function atSet<A = never>(E: Eq<A>): At<Set<A>, A, boolean>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.2.0
*/
var index_1 = require("../index");
var S = require("fp-ts/lib/Set");
/**
* @since 1.2.0
*/
function atSet(E) {

@@ -6,0 +12,0 @@ var elemE = S.elem(E);

@@ -0,4 +1,13 @@

/**
* @since 1.6.0
*/
import { Either } from 'fp-ts/lib/Either';
import { Prism } from '.';
/**
* @since 1.6.0
*/
export declare const _right: <L, A>() => Prism<Either<L, A>, A>;
/**
* @since 1.6.0
*/
export declare const _left: <L, A>() => Prism<Either<L, A>, L>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.6.0
*/
var Either_1 = require("fp-ts/lib/Either");

@@ -7,4 +10,10 @@ var Option_1 = require("fp-ts/lib/Option");

var r = new _1.Prism(Option_1.fromEither, Either_1.right);
/**
* @since 1.6.0
*/
exports._right = function () { return r; };
var l = new _1.Prism(Either_1.fold(Option_1.some, function () { return Option_1.none; }), Either_1.left);
/**
* @since 1.6.0
*/
exports._left = function () { return l; };

@@ -0,1 +1,4 @@

/**
* @since 1.0.0
*/
import { HKT, URIS, URIS2, URIS3, Kind3, Kind2, Kind } from 'fp-ts/lib/HKT';

@@ -8,2 +11,9 @@ import { Monoid } from 'fp-ts/lib/Monoid';

import { Predicate, Refinement } from 'fp-ts/lib/function';
/**
* Laws:
* 1. reverseGet(get(s)) = s
* 2. get(reversetGet(a)) = a
*
* @since 1.0.0
*/
export declare class Iso<S, A> {

@@ -18,38 +28,111 @@ readonly get: (s: S) => A;

constructor(get: (s: S) => A, reverseGet: (a: A) => S);
/** reverse the `Iso`: the source becomes the target and the target becomes the source */
/**
* reverse the `Iso`: the source becomes the target and the target becomes the source
* @since 1.0.0
*/
reverse(): Iso<A, S>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/** view an Iso as a Lens */
/**
* view an `Iso` as a `Lens`
*
* @since 1.0.0
*/
asLens(): Lens<S, A>;
/** view an Iso as a Prism */
/**
* view an `Iso` as a `Prism`
*
* @since 1.0.0
*/
asPrism(): Prism<S, A>;
/** view an Iso as a Optional */
/**
* view an `Iso` as a `Optional`
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view an Iso as a Traversal */
/**
* view an `Iso` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view an Iso as a Fold */
/**
* view an `Iso` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view an Iso as a Getter */
/**
* view an `Iso` as a `Getter`
*
* @since 1.0.0
*/
asGetter(): Getter<S, A>;
/** view an Iso as a Setter */
/**
* view an `Iso` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose an Iso with an Iso */
/**
* compose an `Iso` with an `Iso`
*
* @since 1.0.0
*/
compose<B>(ab: Iso<A, B>): Iso<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Iso<S, B>;
/** compose an Iso with a Lens */
/**
* compose an `Iso` with a `Lens `
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Lens<S, B>;
/** compose an Iso with a Prism */
/**
* compose an `Iso` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Prism<S, B>;
/** compose an Iso with an Optional */
/**
* compose an `Iso` with an `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose an Iso with a Traversal */
/**
* compose an `Iso` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose an Iso with a Fold */
/**
* compose an `Iso` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose an Iso with a Getter */
/**
* compose an `Iso` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose an Iso with a Setter */
/**
* compose an `Iso` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
}
/**
* @since 1.3.0
*/
export interface LensFromPath<S> {

@@ -62,2 +145,10 @@ <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]>;

}
/**
* Laws:
* 1. get(set(a)(s)) = a
* 2. set(get(s))(s) = s
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
export declare class Lens<S, A> {

@@ -86,2 +177,4 @@ readonly get: (s: S) => A;

* assert.deepStrictEqual(city.set('London')(person), { name: 'Giulio', age: 43, address: { city: 'London' } })
*
* @since 1.0.0
*/

@@ -106,6 +199,8 @@ static fromPath<S>(): LensFromPath<S>;

* assert.deepStrictEqual(age.set(44)(person), { name: 'Giulio', age: 44 })
*
* @since 1.0.0
*/
static fromProp<S>(): <P extends keyof S>(prop: P) => Lens<S, S[P]>;
/**
* generate a lens from a type and an array of props
* generate a `Lens` from a type and an array of props
*

@@ -127,2 +222,4 @@ * @example

* assert.deepStrictEqual(lens.set({ name: 'Guido', age: 47 })(person), { name: 'Guido', age: 47, rememberMe: true })
*
* @since 1.0.0
*/

@@ -133,3 +230,3 @@ static fromProps<S>(): <P extends keyof S>(props: Array<P>) => Lens<S, {

/**
* generate a lens from a type and a prop whose type is nullable
* generate a `Lens` from a type and a prop whose type is nullable
*

@@ -156,34 +253,102 @@ * @example

* assert.strictEqual(lens.get({ inner: { value: 1, foo: 'bar' } })), 1)
*
* @since 1.0.0
*/
static fromNullableProp<S>(): <A extends S[K], K extends keyof S>(k: K, defaultValue: A) => Lens<S, NonNullable<S[K]>>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/** view a Lens as a Optional */
/**
* view a `Lens` as a Optional
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view a Lens as a Traversal */
/**
* view a `Lens` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view a Lens as a Setter */
/**
* view a `Lens` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** view a Lens as a Getter */
/**
* view a `Lens` as a `Getter`
*
* @since 1.0.0
*/
asGetter(): Getter<S, A>;
/** view a Lens as a Fold */
/**
* view a `Lens` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Lens with a Lens */
/**
* compose a `Lens` with a `Lens`
*
* @since 1.0.0
*/
compose<B>(ab: Lens<A, B>): Lens<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Lens<S, B>;
/** compose a Lens with a Getter */
/**
* compose a `Lens` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose a Lens with a Fold */
/**
* compose a `Lens` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Lens with an Optional */
/**
* compose a `Lens` with an `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose a Lens with an Traversal */
/**
* compose a `Lens` with an `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Lens with an Setter */
/**
* compose a `Lens` with an `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Lens with an Iso */
/**
* compose a `Lens` with an `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Lens<S, B>;
/** compose a Lens with a Prism */
/**
* compose a `Lens` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Optional<S, B>;
}
/**
* Laws:
* 1. getOption(s).fold(s, reverseGet) = s
* 2. getOption(reverseGet(a)) = Some(a)
*
* @since 1.0.0
*/
export declare class Prism<S, A> {

@@ -194,34 +359,102 @@ readonly getOption: (s: S) => Option<A>;

constructor(getOption: (s: S) => Option<A>, reverseGet: (a: A) => S);
/**
* @since 1.0.0
*/
static fromPredicate<S, A extends S>(refinement: Refinement<S, A>): Prism<S, A>;
static fromPredicate<A>(predicate: Predicate<A>): Prism<A, A>;
/**
* @since 1.0.0
*/
static some<A>(): Prism<Option<A>, A>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
modifyOption(f: (a: A) => A): (s: S) => Option<S>;
/** set the target of a Prism with a value */
/**
* set the target of a `Prism` with a value
*
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/** view a Prism as a Optional */
/**
* view a `Prism` as a `Optional`
*
* @since 1.0.0
*/
asOptional(): Optional<S, A>;
/** view a Prism as a Traversal */
/**
* view a `Prism` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view a Prism as a Setter */
/**
* view a `Prism` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** view a Prism as a Fold */
/**
* view a `Prism` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Prism with a Prism */
/**
* compose a `Prism` with a `Prism`
*
* @since 1.0.0
*/
compose<B>(ab: Prism<A, B>): Prism<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Prism<S, B>;
/** compose a Prism with a Optional */
/**
* compose a `Prism` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose a Prism with a Traversal */
/**
* compose a `Prism` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Prism with a Fold */
/**
* compose a `Prism` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Prism with a Setter */
/**
* compose a `Prism` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Prism with a Iso */
/**
* compose a `Prism` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Prism<S, B>;
/** compose a Prism with a Lens */
/**
* compose a `Prism` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Optional<S, B>;
/** compose a Prism with a Getter */
/**
* compose a `Prism` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;

@@ -233,2 +466,10 @@ }

declare type OptionPropertyType<S, K extends OptionPropertyNames<S>> = S[K] extends Option<infer A> ? A : never;
/**
* Laws:
* 1. getOption(s).fold(() => s, a => set(a)(s)) = s
* 2. getOption(set(a)(s)) = getOption(s).map(_ => a)
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
export declare class Optional<S, A> {

@@ -282,2 +523,4 @@ readonly getOption: (s: S) => Option<A>;

* numberFromResponse.getOption(response2) // none
*
* @since 1.0.0
*/

@@ -311,31 +554,90 @@ static fromNullableProp<S>(): <K extends keyof S>(k: K) => Optional<S, NonNullable<S[K]>>;

* .composeLens(number)
*
* @since 1.0.0
*/
static fromOptionProp<S>(): <P extends OptionPropertyNames<S>>(prop: P) => Optional<S, OptionPropertyType<S, P>>;
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
modifyOption(f: (a: A) => A): (s: S) => Option<S>;
/** view a Optional as a Traversal */
/**
* view a `Optional` as a `Traversal`
*
* @since 1.0.0
*/
asTraversal(): Traversal<S, A>;
/** view an Optional as a Fold */
/**
* view an `Optional` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view an Optional as a Setter */
/**
* view an `Optional` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose a Optional with a Optional */
/**
* compose a `Optional` with a `Optional`
*
* @since 1.0.0
*/
compose<B>(ab: Optional<A, B>): Optional<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Optional<S, B>;
/** compose an Optional with a Traversal */
/**
* compose an `Optional` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose an Optional with a Fold */
/**
* compose an `Optional` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose an Optional with a Setter */
/**
* compose an `Optional` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose an Optional with a Lens */
/**
* compose an `Optional` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Optional<S, B>;
/** compose an Optional with a Prism */
/**
* compose an `Optional` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Optional<S, B>;
/** compose an Optional with a Iso */
/**
* compose an `Optional` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Optional<S, B>;
/** compose an Optional with a Getter */
/**
* compose an `Optional` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
}
/**
* @since 1.0.0
*/
export interface ModifyF<S, A> {

@@ -348,2 +650,5 @@ <F extends URIS3>(F: Applicative3<F>): <U, L>(f: (a: A) => Kind3<F, U, L, A>) => (s: S) => Kind3<F, U, L, S>;

}
/**
* @since 1.0.0
*/
export declare class Traversal<S, A> {

@@ -353,6 +658,12 @@ readonly modifyF: ModifyF<S, A>;

constructor(modifyF: ModifyF<S, A>);
/**
* @since 1.0.0
*/
modify(f: (a: A) => A): (s: S) => S;
/**
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/**
* focus the items matched by a traversal to those that match a predicate
* focus the items matched by a `traversal` to those that match a predicate
*

@@ -376,28 +687,77 @@ * @example

* assert.deepStrictEqual(actual, [{name: 'bill', cool: true}, {name: 'jill', cool: true}])
*
* @since 1.0.0
*/
filter<B extends A>(refinement: Refinement<A, B>): Traversal<S, B>;
filter(predicate: Predicate<A>): Traversal<S, A>;
/** view a Traversal as a Fold */
/**
* view a `Traversal` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** view a Traversal as a Setter */
/**
* view a `Traversal` as a `Setter`
*
* @since 1.0.0
*/
asSetter(): Setter<S, A>;
/** compose a Traversal with a Traversal */
/**
* compose a `Traversal` with a `Traversal`
*
* @since 1.0.0
*/
compose<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Traversal<S, B>;
/** compose a Traversal with a Fold */
/**
* compose a `Traversal` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Traversal with a Setter */
/**
* compose a `Traversal` with a `Setter`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Traversal with a Optional */
/**
* compose a `Traversal` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Traversal<S, B>;
/** compose a Traversal with a Lens */
/**
* compose a `Traversal` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Traversal<S, B>;
/** compose a Traversal with a Prism */
/**
* compose a `Traversal` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Traversal<S, B>;
/** compose a Traversal with a Iso */
/**
* compose a `Traversal` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Traversal<S, B>;
/** compose a Traversal with a Getter */
/**
* compose a `Traversal` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
}
/**
* @since 1.2.0
*/
export declare class At<S, I, A> {

@@ -407,5 +767,12 @@ readonly at: (i: I) => Lens<S, A>;

constructor(at: (i: I) => Lens<S, A>);
/** lift an instance of `At` using an `Iso` */
/**
* lift an instance of `At` using an `Iso`
*
* @since 1.2.0
*/
fromIso<T>(iso: Iso<T, S>): At<T, I, A>;
}
/**
* @since 1.2.0
*/
export declare class Index<S, I, A> {

@@ -415,6 +782,16 @@ readonly index: (i: I) => Optional<S, A>;

constructor(index: (i: I) => Optional<S, A>);
/**
* @since 1.2.0
*/
static fromAt<T, J, B>(at: At<T, J, Option<B>>): Index<T, J, B>;
/** lift an instance of `Index` using an `Iso` */
/**
* lift an instance of `Index` using an `Iso`
*
* @since 1.2.0
*/
fromIso<T>(iso: Iso<T, S>): Index<T, I, A>;
}
/**
* @since 1.0.0
*/
export declare class Getter<S, A> {

@@ -424,54 +801,148 @@ readonly get: (s: S) => A;

constructor(get: (s: S) => A);
/** view a Getter as a Fold */
/**
* view a `Getter` as a `Fold`
*
* @since 1.0.0
*/
asFold(): Fold<S, A>;
/** compose a Getter with a Getter */
/**
* compose a `Getter` with a `Getter`
*
* @since 1.0.0
*/
compose<B>(ab: Getter<A, B>): Getter<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Getter<S, B>;
/** compose a Getter with a Fold */
/**
* compose a `Getter` with a `Fold`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Getter with a Lens */
/**
* compose a `Getter` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Getter<S, B>;
/** compose a Getter with a Iso */
/**
* compose a `Getter` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Getter<S, B>;
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Fold<S, B>;
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Fold<S, B>;
/** compose a Getter with a Prism */
/**
* compose a `Getter` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Fold<S, B>;
}
/**
* @since 1.0.0
*/
export declare class Fold<S, A> {
readonly foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M;
readonly _tag: 'Fold';
/** get all the targets of a Fold */
/**
* get all the targets of a `Fold`
*
* @since 1.0.0
*/
readonly getAll: (s: S) => Array<A>;
/** check if at least one target satisfies the predicate */
/**
* check if at least one target satisfies the predicate
*
* @since 1.0.0
*/
readonly exist: (p: Predicate<A>) => Predicate<S>;
/** check if all targets satisfy the predicate */
/**
* check if all targets satisfy the predicate
*
* @since 1.0.0
*/
readonly all: (p: Predicate<A>) => Predicate<S>;
private foldMapFirst;
constructor(foldMap: <M>(M: Monoid<M>) => (f: (a: A) => M) => (s: S) => M);
/** compose a Fold with a Fold */
/**
* compose a `Fold` with a `Fold`
*
* @since 1.0.0
*/
compose<B>(ab: Fold<A, B>): Fold<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeFold<B>(ab: Fold<A, B>): Fold<S, B>;
/** compose a Fold with a Getter */
/**
* compose a `Fold` with a `Getter`
*
* @since 1.0.0
*/
composeGetter<B>(ab: Getter<A, B>): Fold<S, B>;
/** compose a Fold with a Traversal */
/**
* compose a `Fold` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Fold<S, B>;
/** compose a Fold with a Optional */
/**
* compose a `Fold` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Fold<S, B>;
/** compose a Fold with a Lens */
/**
* compose a `Fold` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Fold<S, B>;
/** compose a Fold with a Prism */
/**
* compose a `Fold` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Fold<S, B>;
/** compose a Fold with a Iso */
/**
* compose a `Fold` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Fold<S, B>;
/** find the first target of a Fold matching the predicate */
/**
* find the first target of a `Fold` matching the predicate
*
* @since 1.0.0
*/
find<B extends A>(p: Refinement<A, B>): (s: S) => Option<B>;
find(p: Predicate<A>): (s: S) => Option<A>;
/** get the first target of a Fold */
/**
* get the first target of a `Fold`
*
* @since 1.0.0
*/
headOption(s: S): Option<A>;
}
/**
* @since 1.0.0
*/
export declare class Setter<S, A> {

@@ -481,20 +952,51 @@ readonly modify: (f: (a: A) => A) => (s: S) => S;

constructor(modify: (f: (a: A) => A) => (s: S) => S);
/**
* @since 1.0.0
*/
set(a: A): (s: S) => S;
/** compose a Setter with a Setter */
/**
* compose a `Setter` with a `Setter`
*
* @since 1.0.0
*/
compose<B>(ab: Setter<A, B>): Setter<S, B>;
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
composeSetter<B>(ab: Setter<A, B>): Setter<S, B>;
/** compose a Setter with a Traversal */
/**
* compose a `Setter` with a `Traversal`
*
* @since 1.0.0
*/
composeTraversal<B>(ab: Traversal<A, B>): Setter<S, B>;
/** compose a Setter with a Optional */
/**
* compose a `Setter` with a `Optional`
*
* @since 1.0.0
*/
composeOptional<B>(ab: Optional<A, B>): Setter<S, B>;
/** compose a Setter with a Lens */
/**
* compose a `Setter` with a `Lens`
*
* @since 1.0.0
*/
composeLens<B>(ab: Lens<A, B>): Setter<S, B>;
/** compose a Setter with a Prism */
/**
* compose a `Setter` with a `Prism`
*
* @since 1.0.0
*/
composePrism<B>(ab: Prism<A, B>): Setter<S, B>;
/** compose a Setter with a Iso */
/**
* compose a `Setter` with a `Iso`
*
* @since 1.0.0
*/
composeIso<B>(ab: Iso<A, B>): Setter<S, B>;
}
/**
* create a Traversal from a Traversable
* create a `Traversal` from a `Traversable`
*

@@ -530,2 +1032,4 @@ * @example

* assert.deepStrictEqual(actual, { tweets: [ { text: 'dlrow olleh' }, { text: 'raboof' } ] })
*
* @since 1.0.0
*/

@@ -536,3 +1040,7 @@ export declare function fromTraversable<T extends URIS3>(T: Traversable3<T>): <U, L, A>() => Traversal<Kind3<T, U, L, A>, A>;

export declare function fromTraversable<T>(T: Traversable<T>): <A>() => Traversal<HKT<T, A>, A>;
/** create a Fold from a Foldable */
/**
* create a `Fold` from a `Foldable`
*
* @since 1.0.0
*/
export declare function fromFoldable<F extends URIS3>(F: Foldable3<F>): <U, L, A>() => Fold<Kind3<F, U, L, A>, A>;

@@ -539,0 +1047,0 @@ export declare function fromFoldable<F extends URIS2>(F: Foldable2<F>): <L, A>() => Fold<Kind2<F, L, A>, A>;

@@ -13,7 +13,9 @@ "use strict";

};
/*
Laws:
1. reverseGet(get(s)) = s
2. get(reversetGet(a)) = a
*/
/**
* Laws:
* 1. reverseGet(get(s)) = s
* 2. get(reversetGet(a)) = a
*
* @since 1.0.0
*/
var Iso = /** @class */ (function () {

@@ -29,6 +31,12 @@ function Iso(get, reverseGet) {

}
/** reverse the `Iso`: the source becomes the target and the target becomes the source */
/**
* reverse the `Iso`: the source becomes the target and the target becomes the source
* @since 1.0.0
*/
Iso.prototype.reverse = function () {
return new Iso(this.reverseGet, this.get);
};
/**
* @since 1.0.0
*/
Iso.prototype.modify = function (f) {

@@ -38,3 +46,7 @@ var _this = this;

};
/** view an Iso as a Lens */
/**
* view an `Iso` as a `Lens`
*
* @since 1.0.0
*/
Iso.prototype.asLens = function () {

@@ -44,3 +56,7 @@ var _this = this;

};
/** view an Iso as a Prism */
/**
* view an `Iso` as a `Prism`
*
* @since 1.0.0
*/
Iso.prototype.asPrism = function () {

@@ -50,3 +66,7 @@ var _this = this;

};
/** view an Iso as a Optional */
/**
* view an `Iso` as a `Optional`
*
* @since 1.0.0
*/
Iso.prototype.asOptional = function () {

@@ -56,3 +76,7 @@ var _this = this;

};
/** view an Iso as a Traversal */
/**
* view an `Iso` as a `Traversal`
*
* @since 1.0.0
*/
Iso.prototype.asTraversal = function () {

@@ -64,3 +88,7 @@ var _this = this;

};
/** view an Iso as a Fold */
/**
* view an `Iso` as a `Fold`
*
* @since 1.0.0
*/
Iso.prototype.asFold = function () {

@@ -70,3 +98,7 @@ var _this = this;

};
/** view an Iso as a Getter */
/**
* view an `Iso` as a `Getter`
*
* @since 1.0.0
*/
Iso.prototype.asGetter = function () {

@@ -76,3 +108,7 @@ var _this = this;

};
/** view an Iso as a Setter */
/**
* view an `Iso` as a `Setter`
*
* @since 1.0.0
*/
Iso.prototype.asSetter = function () {

@@ -82,3 +118,7 @@ var _this = this;

};
/** compose an Iso with an Iso */
/**
* compose an `Iso` with an `Iso`
*
* @since 1.0.0
*/
Iso.prototype.compose = function (ab) {

@@ -88,31 +128,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Iso.prototype.composeIso = function (ab) {
return this.compose(ab);
};
/** compose an Iso with a Lens */
/**
* compose an `Iso` with a `Lens `
*
* @since 1.0.0
*/
Iso.prototype.composeLens = function (ab) {
return this.asLens().compose(ab);
};
/** compose an Iso with a Prism */
/**
* compose an `Iso` with a `Prism`
*
* @since 1.0.0
*/
Iso.prototype.composePrism = function (ab) {
return this.asPrism().compose(ab);
};
/** compose an Iso with an Optional */
/**
* compose an `Iso` with an `Optional`
*
* @since 1.0.0
*/
Iso.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose an Iso with a Traversal */
/**
* compose an `Iso` with a `Traversal`
*
* @since 1.0.0
*/
Iso.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose an Iso with a Fold */
/**
* compose an `Iso` with a `Fold`
*
* @since 1.0.0
*/
Iso.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose an Iso with a Getter */
/**
* compose an `Iso` with a `Getter`
*
* @since 1.0.0
*/
Iso.prototype.composeGetter = function (ab) {
return this.asGetter().compose(ab);
};
/** compose an Iso with a Setter */
/**
* compose an `Iso` with a `Setter`
*
* @since 1.0.0
*/
Iso.prototype.composeSetter = function (ab) {

@@ -124,8 +196,10 @@ return this.asSetter().compose(ab);

exports.Iso = Iso;
/*
Laws:
1. get(set(a)(s)) = a
2. set(get(s))(s) = s
3. set(a)(set(a)(s)) = set(a)(s)
*/
/**
* Laws:
* 1. get(set(a)(s)) = a
* 2. set(get(s))(s) = s
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
var Lens = /** @class */ (function () {

@@ -155,2 +229,4 @@ function Lens(get, set) {

* assert.deepStrictEqual(city.set('London')(person), { name: 'Giulio', age: 43, address: { city: 'London' } })
*
* @since 1.0.0
*/

@@ -181,2 +257,4 @@ Lens.fromPath = function () {

* assert.deepStrictEqual(age.set(44)(person), { name: 'Giulio', age: 44 })
*
* @since 1.0.0
*/

@@ -187,3 +265,3 @@ Lens.fromProp = function () {

/**
* generate a lens from a type and an array of props
* generate a `Lens` from a type and an array of props
*

@@ -205,2 +283,4 @@ * @example

* assert.deepStrictEqual(lens.set({ name: 'Guido', age: 47 })(person), { name: 'Guido', age: 47, rememberMe: true })
*
* @since 1.0.0
*/

@@ -229,3 +309,3 @@ Lens.fromProps = function () {

/**
* generate a lens from a type and a prop whose type is nullable
* generate a `Lens` from a type and a prop whose type is nullable
*

@@ -252,2 +332,4 @@ * @example

* assert.strictEqual(lens.get({ inner: { value: 1, foo: 'bar' } })), 1)
*
* @since 1.0.0
*/

@@ -267,2 +349,5 @@ Lens.fromNullableProp = function () {

};
/**
* @since 1.0.0
*/
Lens.prototype.modify = function (f) {

@@ -276,3 +361,7 @@ var _this = this;

};
/** view a Lens as a Optional */
/**
* view a `Lens` as a Optional
*
* @since 1.0.0
*/
Lens.prototype.asOptional = function () {

@@ -282,3 +371,7 @@ var _this = this;

};
/** view a Lens as a Traversal */
/**
* view a `Lens` as a `Traversal`
*
* @since 1.0.0
*/
Lens.prototype.asTraversal = function () {

@@ -290,3 +383,7 @@ var _this = this;

};
/** view a Lens as a Setter */
/**
* view a `Lens` as a `Setter`
*
* @since 1.0.0
*/
Lens.prototype.asSetter = function () {

@@ -296,3 +393,7 @@ var _this = this;

};
/** view a Lens as a Getter */
/**
* view a `Lens` as a `Getter`
*
* @since 1.0.0
*/
Lens.prototype.asGetter = function () {

@@ -302,3 +403,7 @@ var _this = this;

};
/** view a Lens as a Fold */
/**
* view a `Lens` as a `Fold`
*
* @since 1.0.0
*/
Lens.prototype.asFold = function () {

@@ -308,3 +413,7 @@ var _this = this;

};
/** compose a Lens with a Lens */
/**
* compose a `Lens` with a `Lens`
*
* @since 1.0.0
*/
Lens.prototype.compose = function (ab) {

@@ -314,31 +423,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Lens.prototype.composeLens = function (ab) {
return this.compose(ab);
};
/** compose a Lens with a Getter */
/**
* compose a `Lens` with a `Getter`
*
* @since 1.0.0
*/
Lens.prototype.composeGetter = function (ab) {
return this.asGetter().compose(ab);
};
/** compose a Lens with a Fold */
/**
* compose a `Lens` with a `Fold`
*
* @since 1.0.0
*/
Lens.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Lens with an Optional */
/**
* compose a `Lens` with an `Optional`
*
* @since 1.0.0
*/
Lens.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose a Lens with an Traversal */
/**
* compose a `Lens` with an `Traversal`
*
* @since 1.0.0
*/
Lens.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose a Lens with an Setter */
/**
* compose a `Lens` with an `Setter`
*
* @since 1.0.0
*/
Lens.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Lens with an Iso */
/**
* compose a `Lens` with an `Iso`
*
* @since 1.0.0
*/
Lens.prototype.composeIso = function (ab) {
return this.compose(ab.asLens());
};
/** compose a Lens with a Prism */
/**
* compose a `Lens` with a `Prism`
*
* @since 1.0.0
*/
Lens.prototype.composePrism = function (ab) {

@@ -350,7 +491,9 @@ return this.asOptional().compose(ab.asOptional());

exports.Lens = Lens;
/*
Laws:
1. getOption(s).fold(s, reverseGet) = s
2. getOption(reverseGet(a)) = Some(a)
*/
/**
* Laws:
* 1. getOption(s).fold(s, reverseGet) = s
* 2. getOption(reverseGet(a)) = Some(a)
*
* @since 1.0.0
*/
var Prism = /** @class */ (function () {

@@ -365,5 +508,11 @@ function Prism(getOption, reverseGet) {

};
/**
* @since 1.0.0
*/
Prism.some = function () {
return somePrism;
};
/**
* @since 1.0.0
*/
Prism.prototype.modify = function (f) {

@@ -381,2 +530,5 @@ var _this = this;

};
/**
* @since 1.0.0
*/
Prism.prototype.modifyOption = function (f) {

@@ -391,7 +543,15 @@ var _this = this;

};
/** set the target of a Prism with a value */
/**
* set the target of a `Prism` with a value
*
* @since 1.0.0
*/
Prism.prototype.set = function (a) {
return this.modify(function () { return a; });
};
/** view a Prism as a Optional */
/**
* view a `Prism` as a `Optional`
*
* @since 1.0.0
*/
Prism.prototype.asOptional = function () {

@@ -401,3 +561,7 @@ var _this = this;

};
/** view a Prism as a Traversal */
/**
* view a `Prism` as a `Traversal`
*
* @since 1.0.0
*/
Prism.prototype.asTraversal = function () {

@@ -415,3 +579,7 @@ var _this = this;

};
/** view a Prism as a Setter */
/**
* view a `Prism` as a `Setter`
*
* @since 1.0.0
*/
Prism.prototype.asSetter = function () {

@@ -421,3 +589,7 @@ var _this = this;

};
/** view a Prism as a Fold */
/**
* view a `Prism` as a `Fold`
*
* @since 1.0.0
*/
Prism.prototype.asFold = function () {

@@ -435,3 +607,7 @@ var _this = this;

};
/** compose a Prism with a Prism */
/**
* compose a `Prism` with a `Prism`
*
* @since 1.0.0
*/
Prism.prototype.compose = function (ab) {

@@ -441,31 +617,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Prism.prototype.composePrism = function (ab) {
return this.compose(ab);
};
/** compose a Prism with a Optional */
/**
* compose a `Prism` with a `Optional`
*
* @since 1.0.0
*/
Prism.prototype.composeOptional = function (ab) {
return this.asOptional().compose(ab);
};
/** compose a Prism with a Traversal */
/**
* compose a `Prism` with a `Traversal`
*
* @since 1.0.0
*/
Prism.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose a Prism with a Fold */
/**
* compose a `Prism` with a `Fold`
*
* @since 1.0.0
*/
Prism.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Prism with a Setter */
/**
* compose a `Prism` with a `Setter`
*
* @since 1.0.0
*/
Prism.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Prism with a Iso */
/**
* compose a `Prism` with a `Iso`
*
* @since 1.0.0
*/
Prism.prototype.composeIso = function (ab) {
return this.compose(ab.asPrism());
};
/** compose a Prism with a Lens */
/**
* compose a `Prism` with a `Lens`
*
* @since 1.0.0
*/
Prism.prototype.composeLens = function (ab) {
return this.asOptional().compose(ab.asOptional());
};
/** compose a Prism with a Getter */
/**
* compose a `Prism` with a `Getter`
*
* @since 1.0.0
*/
Prism.prototype.composeGetter = function (ab) {

@@ -478,8 +686,10 @@ return this.asFold().compose(ab.asFold());

var somePrism = new Prism(function_1.identity, Option_1.some);
/*
Laws:
1. getOption(s).fold(() => s, a => set(a)(s)) = s
2. getOption(set(a)(s)) = getOption(s).map(_ => a)
3. set(a)(set(a)(s)) = set(a)(s)
*/
/**
* Laws:
* 1. getOption(s).fold(() => s, a => set(a)(s)) = s
* 2. getOption(set(a)(s)) = getOption(s).map(_ => a)
* 3. set(a)(set(a)(s)) = set(a)(s)
*
* @since 1.0.0
*/
var Optional = /** @class */ (function () {

@@ -534,2 +744,4 @@ function Optional(getOption, set) {

* numberFromResponse.getOption(response2) // none
*
* @since 1.0.0
*/

@@ -565,2 +777,4 @@ Optional.fromNullableProp = function () {

* .composeLens(number)
*
* @since 1.0.0
*/

@@ -571,2 +785,5 @@ Optional.fromOptionProp = function () {

};
/**
* @since 1.0.0
*/
Optional.prototype.modify = function (f) {

@@ -584,2 +801,5 @@ var _this = this;

};
/**
* @since 1.0.0
*/
Optional.prototype.modifyOption = function (f) {

@@ -594,3 +814,7 @@ var _this = this;

};
/** view a Optional as a Traversal */
/**
* view a `Optional` as a `Traversal`
*
* @since 1.0.0
*/
Optional.prototype.asTraversal = function () {

@@ -608,3 +832,7 @@ var _this = this;

};
/** view an Optional as a Fold */
/**
* view an `Optional` as a `Fold`
*
* @since 1.0.0
*/
Optional.prototype.asFold = function () {

@@ -622,3 +850,7 @@ var _this = this;

};
/** view an Optional as a Setter */
/**
* view an `Optional` as a `Setter`
*
* @since 1.0.0
*/
Optional.prototype.asSetter = function () {

@@ -628,3 +860,7 @@ var _this = this;

};
/** compose a Optional with a Optional */
/**
* compose a `Optional` with a `Optional`
*
* @since 1.0.0
*/
Optional.prototype.compose = function (ab) {

@@ -634,31 +870,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Optional.prototype.composeOptional = function (ab) {
return this.compose(ab);
};
/** compose an Optional with a Traversal */
/**
* compose an `Optional` with a `Traversal`
*
* @since 1.0.0
*/
Optional.prototype.composeTraversal = function (ab) {
return this.asTraversal().compose(ab);
};
/** compose an Optional with a Fold */
/**
* compose an `Optional` with a `Fold`
*
* @since 1.0.0
*/
Optional.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose an Optional with a Setter */
/**
* compose an `Optional` with a `Setter`
*
* @since 1.0.0
*/
Optional.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose an Optional with a Lens */
/**
* compose an `Optional` with a `Lens`
*
* @since 1.0.0
*/
Optional.prototype.composeLens = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Prism */
/**
* compose an `Optional` with a `Prism`
*
* @since 1.0.0
*/
Optional.prototype.composePrism = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Iso */
/**
* compose an `Optional` with a `Iso`
*
* @since 1.0.0
*/
Optional.prototype.composeIso = function (ab) {
return this.compose(ab.asOptional());
};
/** compose an Optional with a Getter */
/**
* compose an `Optional` with a `Getter`
*
* @since 1.0.0
*/
Optional.prototype.composeGetter = function (ab) {

@@ -670,2 +938,5 @@ return this.asFold().compose(ab.asFold());

exports.Optional = Optional;
/**
* @since 1.0.0
*/
var Traversal = /** @class */ (function () {

@@ -678,6 +949,11 @@ function Traversal(

}
/**
* @since 1.0.0
*/
Traversal.prototype.modify = function (f) {
var _this = this;
return function (s) { return _this.modifyF(Identity_1.identity)(f)(s); };
return this.modifyF(Identity_1.identity)(f);
};
/**
* @since 1.0.0
*/
Traversal.prototype.set = function (a) {

@@ -689,3 +965,7 @@ return this.modify(function_1.constant(a));

};
/** view a Traversal as a Fold */
/**
* view a `Traversal` as a `Fold`
*
* @since 1.0.0
*/
Traversal.prototype.asFold = function () {

@@ -695,3 +975,7 @@ var _this = this;

};
/** view a Traversal as a Setter */
/**
* view a `Traversal` as a `Setter`
*
* @since 1.0.0
*/
Traversal.prototype.asSetter = function () {

@@ -701,3 +985,7 @@ var _this = this;

};
/** compose a Traversal with a Traversal */
/**
* compose a `Traversal` with a `Traversal`
*
* @since 1.0.0
*/
Traversal.prototype.compose = function (ab) {

@@ -707,31 +995,63 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Traversal.prototype.composeTraversal = function (ab) {
return this.compose(ab);
};
/** compose a Traversal with a Fold */
/**
* compose a `Traversal` with a `Fold`
*
* @since 1.0.0
*/
Traversal.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Traversal with a Setter */
/**
* compose a `Traversal` with a `Setter`
*
* @since 1.0.0
*/
Traversal.prototype.composeSetter = function (ab) {
return this.asSetter().compose(ab);
};
/** compose a Traversal with a Optional */
/**
* compose a `Traversal` with a `Optional`
*
* @since 1.0.0
*/
Traversal.prototype.composeOptional = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Lens */
/**
* compose a `Traversal` with a `Lens`
*
* @since 1.0.0
*/
Traversal.prototype.composeLens = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Prism */
/**
* compose a `Traversal` with a `Prism`
*
* @since 1.0.0
*/
Traversal.prototype.composePrism = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Iso */
/**
* compose a `Traversal` with a `Iso`
*
* @since 1.0.0
*/
Traversal.prototype.composeIso = function (ab) {
return this.compose(ab.asTraversal());
};
/** compose a Traversal with a Getter */
/**
* compose a `Traversal` with a `Getter`
*
* @since 1.0.0
*/
Traversal.prototype.composeGetter = function (ab) {

@@ -743,2 +1063,5 @@ return this.asFold().compose(ab.asFold());

exports.Traversal = Traversal;
/**
* @since 1.2.0
*/
var At = /** @class */ (function () {

@@ -749,3 +1072,7 @@ function At(at) {

}
/** lift an instance of `At` using an `Iso` */
/**
* lift an instance of `At` using an `Iso`
*
* @since 1.2.0
*/
At.prototype.fromIso = function (iso) {

@@ -758,2 +1085,5 @@ var _this = this;

exports.At = At;
/**
* @since 1.2.0
*/
var Index = /** @class */ (function () {

@@ -764,6 +1094,13 @@ function Index(index) {

}
/**
* @since 1.2.0
*/
Index.fromAt = function (at) {
return new Index(function (i) { return at.at(i).composePrism(Prism.some()); });
};
/** lift an instance of `Index` using an `Iso` */
/**
* lift an instance of `Index` using an `Iso`
*
* @since 1.2.0
*/
Index.prototype.fromIso = function (iso) {

@@ -776,2 +1113,5 @@ var _this = this;

exports.Index = Index;
/**
* @since 1.0.0
*/
var Getter = /** @class */ (function () {

@@ -782,3 +1122,7 @@ function Getter(get) {

}
/** view a Getter as a Fold */
/**
* view a `Getter` as a `Fold`
*
* @since 1.0.0
*/
Getter.prototype.asFold = function () {

@@ -788,3 +1132,7 @@ var _this = this;

};
/** compose a Getter with a Getter */
/**
* compose a `Getter` with a `Getter`
*
* @since 1.0.0
*/
Getter.prototype.compose = function (ab) {

@@ -794,27 +1142,55 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Getter.prototype.composeGetter = function (ab) {
return this.compose(ab);
};
/** compose a Getter with a Fold */
/**
* compose a `Getter` with a `Fold`
*
* @since 1.0.0
*/
Getter.prototype.composeFold = function (ab) {
return this.asFold().compose(ab);
};
/** compose a Getter with a Lens */
/**
* compose a `Getter` with a `Lens`
*
* @since 1.0.0
*/
Getter.prototype.composeLens = function (ab) {
return this.compose(ab.asGetter());
};
/** compose a Getter with a Iso */
/**
* compose a `Getter` with a `Iso`
*
* @since 1.0.0
*/
Getter.prototype.composeIso = function (ab) {
return this.compose(ab.asGetter());
};
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
Getter.prototype.composeTraversal = function (ab) {
return this.asFold().compose(ab.asFold());
};
/** compose a Getter with a Optional */
/**
* compose a `Getter` with a `Optional`
*
* @since 1.0.0
*/
Getter.prototype.composeOptional = function (ab) {
return this.asFold().compose(ab.asFold());
};
/** compose a Getter with a Prism */
/**
* compose a `Getter` with a `Prism`
*
* @since 1.0.0
*/
Getter.prototype.composePrism = function (ab) {

@@ -826,2 +1202,5 @@ return this.asFold().compose(ab.asFold());

exports.Getter = Getter;
/**
* @since 1.0.0
*/
var Fold = /** @class */ (function () {

@@ -836,3 +1215,7 @@ function Fold(foldMap) {

}
/** compose a Fold with a Fold */
/**
* compose a `Fold` with a `Fold`
*
* @since 1.0.0
*/
Fold.prototype.compose = function (ab) {

@@ -842,27 +1225,55 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Fold.prototype.composeFold = function (ab) {
return this.compose(ab);
};
/** compose a Fold with a Getter */
/**
* compose a `Fold` with a `Getter`
*
* @since 1.0.0
*/
Fold.prototype.composeGetter = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Traversal */
/**
* compose a `Fold` with a `Traversal`
*
* @since 1.0.0
*/
Fold.prototype.composeTraversal = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Optional */
/**
* compose a `Fold` with a `Optional`
*
* @since 1.0.0
*/
Fold.prototype.composeOptional = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Lens */
/**
* compose a `Fold` with a `Lens`
*
* @since 1.0.0
*/
Fold.prototype.composeLens = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Prism */
/**
* compose a `Fold` with a `Prism`
*
* @since 1.0.0
*/
Fold.prototype.composePrism = function (ab) {
return this.compose(ab.asFold());
};
/** compose a Fold with a Iso */
/**
* compose a `Fold` with a `Iso`
*
* @since 1.0.0
*/
Fold.prototype.composeIso = function (ab) {

@@ -874,3 +1285,7 @@ return this.compose(ab.asFold());

};
/** get the first target of a Fold */
/**
* get the first target of a `Fold`
*
* @since 1.0.0
*/
Fold.prototype.headOption = function (s) {

@@ -882,2 +1297,5 @@ return this.find(function () { return true; })(s);

exports.Fold = Fold;
/**
* @since 1.0.0
*/
var Setter = /** @class */ (function () {

@@ -888,6 +1306,13 @@ function Setter(modify) {

}
/**
* @since 1.0.0
*/
Setter.prototype.set = function (a) {
return this.modify(function_1.constant(a));
};
/** compose a Setter with a Setter */
/**
* compose a `Setter` with a `Setter`
*
* @since 1.0.0
*/
Setter.prototype.compose = function (ab) {

@@ -897,23 +1322,47 @@ var _this = this;

};
/** Alias of `compose` */
/**
* Alias of `compose`
*
* @since 1.0.0
*/
Setter.prototype.composeSetter = function (ab) {
return this.compose(ab);
};
/** compose a Setter with a Traversal */
/**
* compose a `Setter` with a `Traversal`
*
* @since 1.0.0
*/
Setter.prototype.composeTraversal = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Optional */
/**
* compose a `Setter` with a `Optional`
*
* @since 1.0.0
*/
Setter.prototype.composeOptional = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Lens */
/**
* compose a `Setter` with a `Lens`
*
* @since 1.0.0
*/
Setter.prototype.composeLens = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Prism */
/**
* compose a `Setter` with a `Prism`
*
* @since 1.0.0
*/
Setter.prototype.composePrism = function (ab) {
return this.compose(ab.asSetter());
};
/** compose a Setter with a Iso */
/**
* compose a `Setter` with a `Iso`
*
* @since 1.0.0
*/
Setter.prototype.composeIso = function (ab) {

@@ -920,0 +1369,0 @@ return this.compose(ab.asSetter());

@@ -0,2 +1,8 @@

/**
* @since 1.2.0
*/
import { Index } from '../index';
/**
* @since 1.2.0
*/
export declare function indexArray<A = never>(): Index<Array<A>, number, A>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.2.0
*/
var index_1 = require("../index");
var Array_1 = require("fp-ts/lib/Array");
var Option_1 = require("fp-ts/lib/Option");
/**
* @since 1.2.0
*/
function indexArray() {

@@ -7,0 +13,0 @@ return new index_1.Index(function (i) {

@@ -0,3 +1,9 @@

/**
* @since 1.5.0
*/
import { Index } from '../index';
import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray';
/**
* @since 1.5.0
*/
export declare function indexNonEmptyArray<A = never>(): Index<NonEmptyArray<A>, number, A>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.5.0
*/
var index_1 = require("../index");

@@ -7,2 +10,5 @@ var NonEmptyArray_1 = require("fp-ts/lib/NonEmptyArray");

var Option_1 = require("fp-ts/lib/Option");
/**
* @since 1.5.0
*/
function indexNonEmptyArray() {

@@ -9,0 +15,0 @@ return new index_1.Index(function (i) {

@@ -0,2 +1,8 @@

/**
* @since 1.7.0
*/
import { Index } from '../index';
/**
* @since 1.7.0
*/
export declare function indexRecord<A = never>(): Index<Record<string, A>, string, A>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 1.7.0
*/
var index_1 = require("../index");
var Record_1 = require("../At/Record");
/**
* @since 1.7.0
*/
function indexRecord() {

@@ -6,0 +12,0 @@ return index_1.Index.fromAt(Record_1.atRecord());

{
"name": "monocle-ts",
"version": "2.0.0",
"version": "2.0.1",
"description": "A porting of scala monocle library to TypeScript",

@@ -21,3 +21,3 @@ "files": [

"clean": "rimraf lib/* es6/*",
"build": "npm run clean && tsc && tsc -p tsconfig.es6.json",
"build": "npm run clean && tsc && tsc -p tsconfig.es6.json && npm run import-path-rewrite",
"prepublish": "npm run build",

@@ -27,3 +27,4 @@ "docs-fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser markdown --write \"README.md\"",

"mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts",
"docs": "docs-ts"
"docs": "docs-ts",
"import-path-rewrite": "import-path-rewrite"
},

@@ -46,5 +47,6 @@ "repository": {

"@types/node": "7.0.4",
"docs-ts": "^0.1.0",
"docs-ts": "^0.3.0",
"dtslint": "github:gcanti/dtslint",
"fp-ts": "^2.0.0",
"import-path-rewrite": "github:gcanti/import-path-rewrite",
"jest": "^24.3.0",

@@ -58,3 +60,3 @@ "mocha": "^5.2.0",

"tslint-config-standard": "^8.0.1",
"typescript": "^3.5.2"
"typescript": "^3.7.2"
},

@@ -61,0 +63,0 @@ "tags": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc