monocle-ts
Advanced tools
Comparing version
import { HKT } from 'fp-ts/lib/HKT'; | ||
import { Monoid } from 'fp-ts/lib/Monoid'; | ||
import { Applicative } from 'fp-ts/lib/Applicative'; | ||
import { Foldable } from 'fp-ts/lib/Foldable'; | ||
import { Traversable } from 'fp-ts/lib/Traversable'; | ||
import { StaticMonoid } from 'fp-ts/lib/Monoid'; | ||
import { StaticApplicative } from 'fp-ts/lib/Applicative'; | ||
import { StaticFoldable } from 'fp-ts/lib/Foldable'; | ||
import { StaticTraversable } from 'fp-ts/lib/Traversable'; | ||
import { Option } from 'fp-ts/lib/Option'; | ||
@@ -57,4 +57,4 @@ import { Predicate } from 'fp-ts/lib/function'; | ||
export declare class Traversal<S, A> { | ||
modifyF: <F>(applicative: Applicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>; | ||
constructor(modifyF: <F>(applicative: Applicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>); | ||
modifyF: <F>(applicative: StaticApplicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>; | ||
constructor(modifyF: <F>(applicative: StaticApplicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>); | ||
modify(f: (a: A) => A, s: S): S; | ||
@@ -68,6 +68,6 @@ set(a: A, s: S): S; | ||
/** create a Traversal from a Traversable */ | ||
export declare function fromTraversable<T, A>(traversable: Traversable<T>): Traversal<HKT<T, A>, A>; | ||
export declare function fromTraversable<T, A>(traversable: StaticTraversable<T>): Traversal<HKT<T, A>, A>; | ||
export declare class Fold<S, A> { | ||
foldMap: <M>(monoid: Monoid<M>, f: (a: A) => M, s: S) => M; | ||
constructor(foldMap: <M>(monoid: Monoid<M>, f: (a: A) => M, s: S) => M); | ||
foldMap: <M>(monoid: StaticMonoid<M>, f: (a: A) => M, s: S) => M; | ||
constructor(foldMap: <M>(monoid: StaticMonoid<M>, f: (a: A) => M, s: S) => M); | ||
/** compose a Fold with a Fold */ | ||
@@ -87,2 +87,2 @@ compose<B>(ab: Fold<A, B>): Fold<S, B>; | ||
/** create a Fold from a Foldable */ | ||
export declare function fromFoldable<F, A>(fold: Foldable<F>): Fold<HKT<F, A>, A>; | ||
export declare function fromFoldable<F, A>(fold: StaticFoldable<F>): Fold<HKT<F, A>, A>; |
import { monoidArray, monoidAll, monoidAny } from 'fp-ts/lib/Monoid'; | ||
import { foldMap } from 'fp-ts/lib/Foldable'; | ||
import { ops } from 'fp-ts/lib/Foldable'; | ||
import * as option from 'fp-ts/lib/Option'; | ||
@@ -197,3 +197,3 @@ import { Some } from 'fp-ts/lib/Option'; | ||
Fold.prototype.find = function (p, s) { | ||
return this.foldMap(option.monoidFirst, function (a) { return p(a) ? option.of(a) : option.none; }, s); | ||
return this.foldMap(option.getFirstStaticMonoid(), function (a) { return p(a) ? option.of(a) : option.none; }, s); | ||
}; | ||
@@ -218,5 +218,5 @@ /** get the first target of a Fold */ | ||
return new Fold(function (monoid, f, s) { | ||
return foldMap(fold, monoid, f, s); | ||
return ops.foldMapS(fold, monoid, f, s); | ||
}); | ||
} | ||
//# sourceMappingURL=index.js.map |
import { HKT } from 'fp-ts/lib/HKT'; | ||
import { Monoid } from 'fp-ts/lib/Monoid'; | ||
import { Applicative } from 'fp-ts/lib/Applicative'; | ||
import { Foldable } from 'fp-ts/lib/Foldable'; | ||
import { Traversable } from 'fp-ts/lib/Traversable'; | ||
import { StaticMonoid } from 'fp-ts/lib/Monoid'; | ||
import { StaticApplicative } from 'fp-ts/lib/Applicative'; | ||
import { StaticFoldable } from 'fp-ts/lib/Foldable'; | ||
import { StaticTraversable } from 'fp-ts/lib/Traversable'; | ||
import { Option } from 'fp-ts/lib/Option'; | ||
@@ -57,4 +57,4 @@ import { Predicate } from 'fp-ts/lib/function'; | ||
export declare class Traversal<S, A> { | ||
modifyF: <F>(applicative: Applicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>; | ||
constructor(modifyF: <F>(applicative: Applicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>); | ||
modifyF: <F>(applicative: StaticApplicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>; | ||
constructor(modifyF: <F>(applicative: StaticApplicative<F>, f: (a: A) => HKT<F, A>, s: S) => HKT<F, S>); | ||
modify(f: (a: A) => A, s: S): S; | ||
@@ -68,6 +68,6 @@ set(a: A, s: S): S; | ||
/** create a Traversal from a Traversable */ | ||
export declare function fromTraversable<T, A>(traversable: Traversable<T>): Traversal<HKT<T, A>, A>; | ||
export declare function fromTraversable<T, A>(traversable: StaticTraversable<T>): Traversal<HKT<T, A>, A>; | ||
export declare class Fold<S, A> { | ||
foldMap: <M>(monoid: Monoid<M>, f: (a: A) => M, s: S) => M; | ||
constructor(foldMap: <M>(monoid: Monoid<M>, f: (a: A) => M, s: S) => M); | ||
foldMap: <M>(monoid: StaticMonoid<M>, f: (a: A) => M, s: S) => M; | ||
constructor(foldMap: <M>(monoid: StaticMonoid<M>, f: (a: A) => M, s: S) => M); | ||
/** compose a Fold with a Fold */ | ||
@@ -87,2 +87,2 @@ compose<B>(ab: Fold<A, B>): Fold<S, B>; | ||
/** create a Fold from a Foldable */ | ||
export declare function fromFoldable<F, A>(fold: Foldable<F>): Fold<HKT<F, A>, A>; | ||
export declare function fromFoldable<F, A>(fold: StaticFoldable<F>): Fold<HKT<F, A>, A>; |
@@ -199,3 +199,3 @@ "use strict"; | ||
Fold.prototype.find = function (p, s) { | ||
return this.foldMap(option.monoidFirst, function (a) { return p(a) ? option.of(a) : option.none; }, s); | ||
return this.foldMap(option.getFirstStaticMonoid(), function (a) { return p(a) ? option.of(a) : option.none; }, s); | ||
}; | ||
@@ -220,3 +220,3 @@ /** get the first target of a Fold */ | ||
return new Fold(function (monoid, f, s) { | ||
return Foldable_1.foldMap(fold, monoid, f, s); | ||
return Foldable_1.ops.foldMapS(fold, monoid, f, s); | ||
}); | ||
@@ -223,0 +223,0 @@ } |
{ | ||
"name": "monocle-ts", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A porting of scala monocle library to TypeScript", | ||
@@ -27,3 +27,3 @@ "files": [ | ||
"dependencies": { | ||
"fp-ts": "^0.0.1" | ||
"fp-ts": "^0.1.1" | ||
}, | ||
@@ -39,3 +39,3 @@ "devDependencies": { | ||
"typescript", | ||
"functional programming", | ||
"functional-programming", | ||
"optics", | ||
@@ -46,3 +46,3 @@ "lens" | ||
"typescript", | ||
"functional programming", | ||
"functional-programming", | ||
"optics", | ||
@@ -49,0 +49,0 @@ "lens" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
43962
0.42%+ Added
- Removed
Updated