@matechs/effect
Advanced tools
Comparing version 0.2.14 to 0.2.15
@@ -5,3 +5,2 @@ import { Either } from "fp-ts/lib/Either"; | ||
import { Runtime } from "./original/runtime"; | ||
import { NoEnv } from "./effect"; | ||
import * as T from "./effect"; | ||
@@ -83,5 +82,5 @@ import * as L from "./list"; | ||
loop(go: T.Instructions): void; | ||
start(run: T.Effect<NoEnv, E, A>): void; | ||
start(run: T.Effect<T.Env, E, A>): void; | ||
interrupt(): void; | ||
} | ||
export {}; |
@@ -30,5 +30,4 @@ import { Bifunctor3 } from "fp-ts/lib/Bifunctor"; | ||
export interface Env { | ||
[k: string]: any; | ||
} | ||
export declare const noEnv: {}; | ||
export declare const noEnv: Env; | ||
/** | ||
@@ -206,6 +205,6 @@ * A description of an effect to perform | ||
export declare function withRuntime<E, A>(f: FunctionN<[Runtime], Effect<NoEnv, E, A>>): Effect<NoEnv, E, A>; | ||
export declare function accessEnvironment<R extends Env>(): Effect<R, NoErr, R>; | ||
export declare function accessM<R extends Env, R2, E, A>(f: FunctionN<[R], Effect<R2, E, A>>): Effect<R & R2, E, A>; | ||
export declare function accessEnvironment<R>(): Effect<R, NoErr, R>; | ||
export declare function accessM<R extends Env, R2 extends Env, E, A>(f: FunctionN<[R], Effect<R2, E, A>>): Effect<R & R2, E, A>; | ||
export declare function access<R extends Env, A, E = NoErr>(f: FunctionN<[R], A>): Effect<R, E, A>; | ||
export declare function mergeEnv<A>(a: A): <B>(b: B) => A & B; | ||
export declare function mergeEnv<A extends Env>(a: A): <B extends Env>(b: B) => A & B; | ||
/** | ||
@@ -215,12 +214,12 @@ * Provides partial environment, to be used only in top-level | ||
*/ | ||
export declare const provide: <R>(r: R) => <R2, E, A>(ma: Effect<R2 & R, E, A>) => Effect<R2, E, A>; | ||
export declare const provide: <R extends Env>(r: R) => <R2, E, A>(ma: Effect<R2 & R, E, A>) => Effect<R2, E, A>; | ||
/** | ||
* Provides partial environment, to be used only in top-level | ||
* for deeper level is better to use provideR or provideAll | ||
* Provides partial environment, via direct transformation | ||
* safe to use in non top-level scenarios | ||
*/ | ||
export declare const provideR: <R2, R>(f: (r2: R2) => R) => <E, A>(ma: Effect<R, E, A>) => Effect<R2, E, A>; | ||
export declare const provideR: <R2 extends Env, R extends Env>(f: (r2: R2) => R) => <E, A>(ma: Effect<R, E, A>) => Effect<R2, E, A>; | ||
/** | ||
* Provides all environment to the child | ||
*/ | ||
export declare const provideAll: <R>(r: R) => <E, A>(ma: Effect<R, E, A>) => Effect<unknown, E, A>; | ||
export declare const provideAll: <R extends Env>(r: R) => <E, A>(ma: Effect<R, E, A>) => Effect<unknown, E, A>; | ||
/** | ||
@@ -231,3 +230,3 @@ * Provides all environment necessary to the child effect via an effect | ||
*/ | ||
export declare const provideM: <R2, R, E2>(f: Effect<R2, E2, R>) => <E, A>(ma: Effect<R, E, A>) => Effect<R2, E2 | E, A>; | ||
export declare const provideM: <R2 extends Env, R extends Env, E2>(f: Effect<R2, E2, R>) => <E, A>(ma: Effect<R, E, A>) => Effect<R2, E2 | E, A>; | ||
/** | ||
@@ -238,3 +237,3 @@ * Provides some of the environment necessary to the child effect via an effect | ||
*/ | ||
export declare const provideSomeM: <R2, R, E2>(f: Effect<R2, E2, R>) => <E, A, R3>(ma: Effect<R & R3, E, A>) => Effect<R2 & R3, E2 | E, A>; | ||
export declare const provideSomeM: <R2 extends Env, R extends Env, E2>(f: Effect<R2, E2, R>) => <E, A, R3>(ma: Effect<R & R3, E, A>) => Effect<R2 & R3, E2 | E, A>; | ||
/** | ||
@@ -578,3 +577,3 @@ * Lift a function on values to a function on IOs | ||
*/ | ||
export declare function run<E, A>(io: Effect<NoEnv, E, A>, callback?: FunctionN<[Exit<E, A>], void>): Lazy<void>; | ||
export declare function run<E, A>(io: Effect<Env, E, A>, callback?: FunctionN<[Exit<E, A>], void>): Lazy<void>; | ||
/** | ||
@@ -596,3 +595,3 @@ * Run an IO and return a Promise of its result | ||
*/ | ||
export declare function runToPromiseExit<E, A>(io: Effect<NoEnv, E, A>): Promise<Exit<E, A>>; | ||
export declare function runToPromiseExit<E, A>(io: Effect<Env, E, A>): Promise<Exit<E, A>>; | ||
export declare const URI = "matechs/Effect"; | ||
@@ -599,0 +598,0 @@ export declare type URI = typeof URI; |
@@ -266,4 +266,4 @@ "use strict"; | ||
/** | ||
* Provides partial environment, to be used only in top-level | ||
* for deeper level is better to use provideR or provideAll | ||
* Provides partial environment, via direct transformation | ||
* safe to use in non top-level scenarios | ||
*/ | ||
@@ -282,3 +282,5 @@ exports.provideR = function (f) { return function (ma) { return accessM(function (r2) { return exports.provideAll(f(r2))(ma); }); }; }; | ||
*/ | ||
exports.provideM = function (f) { return function (ma) { return chain_(f, function (r) { return exports.provide(r)(ma); }); }; }; | ||
exports.provideM = function (f) { return function (ma) { | ||
return chain_(f, function (r) { return exports.provide(r)(ma); }); | ||
}; }; | ||
/** | ||
@@ -289,3 +291,5 @@ * Provides some of the environment necessary to the child effect via an effect | ||
*/ | ||
exports.provideSomeM = function (f) { return function (ma) { return chain_(f, function (r) { return exports.provide(r)(ma); }); }; }; | ||
exports.provideSomeM = function (f) { return function (ma) { | ||
return chain_(f, function (r) { return exports.provide(r)(ma); }); | ||
}; }; | ||
/** | ||
@@ -292,0 +296,0 @@ * Map the value produced by an IO |
@@ -167,3 +167,3 @@ import { FunctionN } from "fp-ts/lib/function"; | ||
*/ | ||
export declare function provideTo<R, E, R2 extends T.Env, A, E2>(man: Managed<R, E, R2>, ma: T.Effect<R2, E2, A>): T.Effect<R, E | E2, A>; | ||
export declare function provideTo<R extends T.Env, E, R2 extends T.Env, A, E2>(man: Managed<R, E, R2>, ma: T.Effect<R2, E2, A>): T.Effect<R, E | E2, A>; | ||
export declare const URI = "matechs/Managed"; | ||
@@ -170,0 +170,0 @@ export declare type URI = typeof URI; |
export declare function isObject(item: unknown): boolean; | ||
export declare function mergeDeep<A, B>(target: A, source: B): A & B; | ||
export declare function mergeDeep<A, B extends object>(target: A, source: B): A & B; |
@@ -11,3 +11,4 @@ "use strict"; | ||
if (isObject(target) && isObject(source)) { | ||
for (var key in source) { | ||
for (var _i = 0, _c = Reflect.ownKeys(source); _i < _c.length; _i++) { | ||
var key = _c[_i]; | ||
if (isObject(source[key])) { | ||
@@ -14,0 +15,0 @@ if (!c[key]) { |
{ | ||
"name": "@matechs/effect", | ||
"version": "0.2.14", | ||
"version": "0.2.15", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "private": false, | ||
}, | ||
"gitHead": "9af62423fc1433fa0627f8a2a2954168a32a40cc" | ||
"gitHead": "e347ad04e17c1c9648c3f1e0b54c2629230b2ec2" | ||
} |
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
349008
6202