Comparing version 0.2.4 to 0.2.5
@@ -15,2 +15,13 @@ # Changelog | ||
# 0.2.5 | ||
- **New Feature** | ||
- add `getOrElse` to `Either`, fix #39 (@sledorze) | ||
- **Experimental** | ||
- add `EitherT`, fix #36 (@gcanti) | ||
- add `OptionT`, fix #37 (@gcanti) | ||
- add `ReaderT`, fix #38 (@gcanti) | ||
- add `Trans` typeclass (`liftT`), fix #40 (@gcanti) | ||
- add `Free`, fix #42 (@gcanti) | ||
# 0.2.4 | ||
@@ -17,0 +28,0 @@ |
@@ -8,1 +8,3 @@ import { HKTS } from './HKT'; | ||
} | ||
/** returns the composition of two applicatives */ | ||
export declare function getApplicativeComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(applicativeF: StaticApplicative<F>, applicativeG: StaticApplicative<G>) => StaticApplicative<FG>; |
@@ -0,1 +1,24 @@ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
import { getFunctorComposition } from './Functor'; | ||
/** returns the composition of two applicatives */ | ||
export function getApplicativeComposition(URI) { | ||
return function (applicativeF, applicativeG) { | ||
var functor = getFunctorComposition(URI)(applicativeF, applicativeG); | ||
function of(a) { | ||
return applicativeF.of(applicativeG.of(a)); | ||
} | ||
function ap(fgab, fga) { | ||
return applicativeF.ap(applicativeF.map(function (h) { return function (ga) { return applicativeG.ap(h, ga); }; }, fgab), fga); | ||
} | ||
return __assign({}, functor, { of: of, | ||
ap: ap }); | ||
}; | ||
} | ||
//# sourceMappingURL=Applicative.js.map |
@@ -14,2 +14,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
_A: T; | ||
_URI: URI; | ||
} | ||
@@ -16,0 +17,0 @@ } |
@@ -10,3 +10,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
} | ||
export declare function flatten<F extends HKT2S>(chain: StaticChain<F>): <A, P1>(mma: HKT2<P1, HKT2<P1, A>[F]>[F]) => HKT2<P1, A>[F]; | ||
export declare function flatten<F extends HKT2S>(chain: StaticChain<F>): <L, A>(mma: HKT2<L, HKT2<L, A>[F]>[F]) => HKT2<L, A>[F]; | ||
export declare function flatten<F extends HKTS>(chain: StaticChain<F>): <A>(mma: HKT<HKT<A>[F]>[F]) => HKT<A>[F]; |
@@ -13,1 +13,3 @@ import { HKT, HKTS } from './HKT'; | ||
export declare function toArray<F extends HKTS, A>(foldable: StaticFoldable<F>, fa: HKT<A>[F]): Array<A>; | ||
/** returns the composition of two foldables */ | ||
export declare function getFoldableComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(foldableF: StaticFoldable<F>, foldableG: StaticFoldable<G>) => StaticFoldable<FG>; |
@@ -8,2 +8,14 @@ import { monoidArray } from './Monoid'; | ||
} | ||
/** returns the composition of two foldables */ | ||
export function getFoldableComposition(URI) { | ||
return function (foldableF, foldableG) { | ||
function reduce(f, b, fga) { | ||
return foldableF.reduce(function (b, ga) { return foldableG.reduce(f, b, ga); }, b, fga); | ||
} | ||
return { | ||
URI: URI, | ||
reduce: reduce | ||
}; | ||
}; | ||
} | ||
//# sourceMappingURL=Foldable.js.map |
@@ -11,1 +11,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
export declare function lift<F extends HKTS, A, B>(functor: StaticFunctor<F>, f: (a: A) => B): (fa: HKT<A>[F]) => HKT<B>[F]; | ||
/** returns the composition of two functors */ | ||
export declare function getFunctorComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(functorF: StaticFunctor<F>, functorG: StaticFunctor<G>) => StaticFunctor<FG>; |
export function lift(functor, f) { | ||
return function (fa) { return functor.map(f, fa); }; | ||
} | ||
/** returns the composition of two functors */ | ||
export function getFunctorComposition(URI) { | ||
return function (functorF, functorG) { return ({ | ||
URI: URI, | ||
map: function (f, fa) { | ||
return functorF.map(function (ga) { return functorG.map(f, ga); }, fa); | ||
} | ||
}); }; | ||
} | ||
//# sourceMappingURL=Functor.js.map |
@@ -11,3 +11,5 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
} | ||
export declare function sequence<F extends HKT2S, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <A, P1>(tfa: HKT<HKT2<P1, A>[F]>[T]) => HKT2<P1, HKT<A>[T]>[F]; | ||
export declare function sequence<F extends HKT2S, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <L, A>(tfa: HKT<HKT2<L, A>[F]>[T]) => HKT2<L, HKT<A>[T]>[F]; | ||
export declare function sequence<F extends HKTS, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <A>(tfa: HKT<HKT<A>[F]>[T]) => HKT<HKT<A>[T]>[F]; | ||
/** returns the composition of two traversables */ | ||
export declare function getTraversableComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(traversableF: StaticTraversable<F>, traversableG: StaticTraversable<G>) => StaticTraversable<FG>; |
@@ -0,1 +1,11 @@ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
import { getFunctorComposition } from './Functor'; | ||
import { getFoldableComposition } from './Foldable'; | ||
import { identity } from './function'; | ||
@@ -5,2 +15,15 @@ export function sequence(applicative, traversable) { | ||
} | ||
/** returns the composition of two traversables */ | ||
export function getTraversableComposition(URI) { | ||
return function (traversableF, traversableG) { | ||
var functor = getFunctorComposition(URI)(traversableF, traversableG); | ||
var foldable = getFoldableComposition(URI)(traversableF, traversableG); | ||
function traverse(applicative) { | ||
return function (f, fga) { | ||
return traversableF.traverse(applicative)(function (ga) { return traversableG.traverse(applicative)(f, ga); }, fga); | ||
}; | ||
} | ||
return __assign({}, functor, foldable, { traverse: traverse }); | ||
}; | ||
} | ||
//# sourceMappingURL=Traversable.js.map |
@@ -8,1 +8,3 @@ import { HKTS } from './HKT'; | ||
} | ||
/** returns the composition of two applicatives */ | ||
export declare function getApplicativeComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(applicativeF: StaticApplicative<F>, applicativeG: StaticApplicative<G>) => StaticApplicative<FG>; |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Functor_1 = require("./Functor"); | ||
/** returns the composition of two applicatives */ | ||
function getApplicativeComposition(URI) { | ||
return function (applicativeF, applicativeG) { | ||
var functor = Functor_1.getFunctorComposition(URI)(applicativeF, applicativeG); | ||
function of(a) { | ||
return applicativeF.of(applicativeG.of(a)); | ||
} | ||
function ap(fgab, fga) { | ||
return applicativeF.ap(applicativeF.map(function (h) { return function (ga) { return applicativeG.ap(h, ga); }; }, fgab), fga); | ||
} | ||
return __assign({}, functor, { of: of, | ||
ap: ap }); | ||
}; | ||
} | ||
exports.getApplicativeComposition = getApplicativeComposition; | ||
//# sourceMappingURL=Applicative.js.map |
@@ -14,2 +14,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
_A: T; | ||
_URI: URI; | ||
} | ||
@@ -16,0 +17,0 @@ } |
@@ -10,3 +10,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
} | ||
export declare function flatten<F extends HKT2S>(chain: StaticChain<F>): <A, P1>(mma: HKT2<P1, HKT2<P1, A>[F]>[F]) => HKT2<P1, A>[F]; | ||
export declare function flatten<F extends HKT2S>(chain: StaticChain<F>): <L, A>(mma: HKT2<L, HKT2<L, A>[F]>[F]) => HKT2<L, A>[F]; | ||
export declare function flatten<F extends HKTS>(chain: StaticChain<F>): <A>(mma: HKT<HKT<A>[F]>[F]) => HKT<A>[F]; |
@@ -13,1 +13,3 @@ import { HKT, HKTS } from './HKT'; | ||
export declare function toArray<F extends HKTS, A>(foldable: StaticFoldable<F>, fa: HKT<A>[F]): Array<A>; | ||
/** returns the composition of two foldables */ | ||
export declare function getFoldableComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(foldableF: StaticFoldable<F>, foldableG: StaticFoldable<G>) => StaticFoldable<FG>; |
@@ -12,2 +12,15 @@ "use strict"; | ||
exports.toArray = toArray; | ||
/** returns the composition of two foldables */ | ||
function getFoldableComposition(URI) { | ||
return function (foldableF, foldableG) { | ||
function reduce(f, b, fga) { | ||
return foldableF.reduce(function (b, ga) { return foldableG.reduce(f, b, ga); }, b, fga); | ||
} | ||
return { | ||
URI: URI, | ||
reduce: reduce | ||
}; | ||
}; | ||
} | ||
exports.getFoldableComposition = getFoldableComposition; | ||
//# sourceMappingURL=Foldable.js.map |
@@ -11,1 +11,3 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
export declare function lift<F extends HKTS, A, B>(functor: StaticFunctor<F>, f: (a: A) => B): (fa: HKT<A>[F]) => HKT<B>[F]; | ||
/** returns the composition of two functors */ | ||
export declare function getFunctorComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(functorF: StaticFunctor<F>, functorG: StaticFunctor<G>) => StaticFunctor<FG>; |
@@ -7,2 +7,12 @@ "use strict"; | ||
exports.lift = lift; | ||
/** returns the composition of two functors */ | ||
function getFunctorComposition(URI) { | ||
return function (functorF, functorG) { return ({ | ||
URI: URI, | ||
map: function (f, fa) { | ||
return functorF.map(function (ga) { return functorG.map(f, ga); }, fa); | ||
} | ||
}); }; | ||
} | ||
exports.getFunctorComposition = getFunctorComposition; | ||
//# sourceMappingURL=Functor.js.map |
@@ -11,3 +11,5 @@ import { HKT, HKTS, HKT2, HKT2S } from './HKT'; | ||
} | ||
export declare function sequence<F extends HKT2S, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <A, P1>(tfa: HKT<HKT2<P1, A>[F]>[T]) => HKT2<P1, HKT<A>[T]>[F]; | ||
export declare function sequence<F extends HKT2S, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <L, A>(tfa: HKT<HKT2<L, A>[F]>[T]) => HKT2<L, HKT<A>[T]>[F]; | ||
export declare function sequence<F extends HKTS, T extends HKTS>(applicative: StaticApplicative<F>, traversable: StaticTraversable<T>): <A>(tfa: HKT<HKT<A>[F]>[T]) => HKT<HKT<A>[T]>[F]; | ||
/** returns the composition of two traversables */ | ||
export declare function getTraversableComposition<FG extends HKTS>(URI: FG): <F extends HKTS, G extends HKTS>(traversableF: StaticTraversable<F>, traversableG: StaticTraversable<G>) => StaticTraversable<FG>; |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Functor_1 = require("./Functor"); | ||
var Foldable_1 = require("./Foldable"); | ||
var function_1 = require("./function"); | ||
@@ -8,2 +18,16 @@ function sequence(applicative, traversable) { | ||
exports.sequence = sequence; | ||
/** returns the composition of two traversables */ | ||
function getTraversableComposition(URI) { | ||
return function (traversableF, traversableG) { | ||
var functor = Functor_1.getFunctorComposition(URI)(traversableF, traversableG); | ||
var foldable = Foldable_1.getFoldableComposition(URI)(traversableF, traversableG); | ||
function traverse(applicative) { | ||
return function (f, fga) { | ||
return traversableF.traverse(applicative)(function (ga) { return traversableG.traverse(applicative)(f, ga); }, fga); | ||
}; | ||
} | ||
return __assign({}, functor, foldable, { traverse: traverse }); | ||
}; | ||
} | ||
exports.getTraversableComposition = getTraversableComposition; | ||
//# sourceMappingURL=Traversable.js.map |
{ | ||
"name": "fp-ts", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Functional programming in TypeScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
462427
298
7467