UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

239 lines 7.91 kB
/** * @typed/fp/FxEnvEither is a generator-based do-notation for EnvEither. * * @since 0.13.0 */ import { Applicative3 } from 'fp-ts/Applicative'; import { Apply3 } from 'fp-ts/Apply'; import { Chain3 } from 'fp-ts/Chain'; import { ChainRec3 } from 'fp-ts/ChainRec'; import * as EI from 'fp-ts/Either'; import { FromReader3 } from 'fp-ts/FromReader'; import { Functor3 } from 'fp-ts/Functor'; import * as IO from 'fp-ts/IO'; import { Monad3 } from 'fp-ts/Monad'; import { Pointed3 } from 'fp-ts/Pointed'; import * as E from './Env'; import * as EE from './EnvEither'; import { Lazy } from './function'; import { Fx } from './Fx'; import * as FxT from './FxT'; import * as P from './Provide'; import * as R from './Reader'; /** * @category Constructor * @since 0.13.0 */ export declare const of: <A, R = unknown, E = never>(value: A) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const ap: <R1, E1, A>(fa: Fx<EE.EnvEither<R1, E1, unknown>, A, unknown>) => <R2, E2, B>(fab: Fx<EE.EnvEither<R2, E2, unknown>, import("./function").Arity1<A, B>, unknown>) => Fx<EE.EnvEither<R1 & R2, E1 | E2, unknown>, B, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const chain: <A, R1, E1, B>(f: (value: A) => Fx<EE.EnvEither<R1, E1, unknown>, B, unknown>) => <R2, E2>(fx: Fx<EE.EnvEither<R2, E2, unknown>, A, unknown>) => Fx<EE.EnvEither<R1 & R2, E1 | E2, unknown>, B, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const chainRec: <A, R, E, B>(f: import("./function").Arity1<A, Fx<EE.EnvEither<R, E, unknown>, EI.Either<A, B>, unknown>>) => (a: A) => Fx<EE.EnvEither<R, E, unknown>, B, unknown>; /** * @category Do * @since 0.13.0 */ export declare const doEnvEither: <Y extends EE.EnvEither<any, any, any>, Z, N = unknown>(f: (lift: FxT.LiftFx3<"@typed/fp/EnvEither">) => Generator<Y, Z, N>) => Fx<Y, Z, N>; /** * @category Constructor * @since 0.13.0 */ export declare const liftEnvEither: FxT.LiftFx3<"@typed/fp/EnvEither">; /** * @category Combinator * @since 0.13.0 */ export declare const map: <A, B>(f: (value: A) => B) => <R, E>(fx: Fx<EE.EnvEither<R, E, unknown>, A, unknown>) => Fx<EE.EnvEither<R, E, unknown>, B, unknown>; /** * @category Interpreter * @since 0.13.0 */ export declare const toEnvEither: <E extends EE.EnvEither<any, any, any>, R>(fx: Fx<E, R, unknown>) => EE.EnvEither<import("./HKT").Intersect<import("ts-toolbelt/out/Union/ListOf").ListOf<[E] extends [EE.EnvEither<infer R_1, any, any>] ? R_1 : never>, unknown>, import("ts-toolbelt/out/Union/ListOf").ListOf<[E] extends [EE.EnvEither<any, infer R_2, any>] ? R_2 : never>[number], R>; /** * @category Constructor * @since 0.13.0 */ export declare const ask: <A>() => Fx<EE.EnvEither<A, never, A>, A, unknown>; /** * @category Constructor * @since 0.13.0 */ export declare const asks: <E, A, R = unknown>(fa: R.Reader<E, A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @category Constructor * @since 0.13.1 */ export declare const fromEither: <E, A, R = unknown>(fa: EI.Either<E, A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @category Constructor * @since 0.13.1 */ export declare const fromEnv: <E, A, R = unknown>(fa: E.Env<E, A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @category Constructor * @since 0.13.1 */ export declare const fromIO: <A, R = unknown, E = never>(fa: IO.IO<A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const useSome: <A>(provided: A) => <B, E, T>(fx: Fx<EE.EnvEither<A & B, E, unknown>, T, unknown>) => Fx<EE.EnvEither<B, E, unknown>, T, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const useAll: <A>(provided: A) => <E, T>(fx: Fx<EE.EnvEither<A, E, unknown>, T, unknown>) => Fx<EE.EnvEither<unknown, E, unknown>, T, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const provideSome: <A>(provided: A) => <B, E, T>(fx: Fx<EE.EnvEither<A & B, E, unknown>, T, unknown>) => Fx<EE.EnvEither<B, E, unknown>, T, unknown>; /** * @category Combinator * @since 0.13.0 */ export declare const provideAll: <A>(provided: A) => <E, T>(fx: Fx<EE.EnvEither<A, E, unknown>, T, unknown>) => Fx<EE.EnvEither<unknown, E, unknown>, T, unknown>; /** * @category Interpreter * @since 0.13.0 */ export declare const Do: <Y extends EE.EnvEither<any, any, any>, Z, N = unknown>(f: (lift: FxT.LiftFx3<"@typed/fp/EnvEither">) => Generator<Y, Z, N>) => EE.EnvEither<import("./HKT").Intersect<import("ts-toolbelt/out/Union/ListOf").ListOf<[Y] extends [EE.EnvEither<infer R_1, any, any>] ? R : never>, unknown>, import("ts-toolbelt/out/Union/ListOf").ListOf<[Y] extends [EE.EnvEither<any, infer R_2, any>] ? R_1 : never>[number], Z>; /** * @category URI * @since 0.13.0 */ export declare const URI = "@typed/fp/Fx/EnvEither"; /** * @category URI * @since 0.13.0 */ export declare type URI = typeof URI; /** * @category Model * @since 0.13.0 */ export interface FxEnvEither<R, E, A> extends Fx<EE.EnvEither<R, E, unknown>, A> { } declare module 'fp-ts/HKT' { interface URItoKind3<R, E, A> { [URI]: FxEnvEither<R, E, A>; } } /** * @category Instance * @since 0.13.0 */ export declare const Pointed: Pointed3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Functor: Functor3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Apply: Apply3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Applicative: Applicative3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Chain: Chain3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Monad: Monad3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const ChainRec: ChainRec3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const UseSome: P.UseSome3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const UseAll: P.UseAll3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const ProvideSome: P.ProvideSome3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const ProvideAll: P.ProvideAll3<URI>; /** * @category Instance * @since 0.13.0 */ export declare const Provide: P.Provide3<URI>; /** * @since 0.13.1 * @category Constructor */ export declare const fromOption: <E>(lazy: Lazy<E>) => <A, R>(fa: import("fp-ts/Option").Option<A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @since 0.13.0 * @category Constructor */ export declare const fromReader: <R, A, E = never>(fa: R.Reader<R, A>) => Fx<EE.EnvEither<R, E, A>, A, unknown>; /** * @since 0.13.0 * @category Instance */ export declare const FromReader: FromReader3<URI>; /** * @since 0.13.0 * @category Combinator */ export declare const provideAllWith: <R, E1, A>(provider: FxEnvEither<R, E1, A>) => <E2, B>(hkt: FxEnvEither<A, E2, B>) => FxEnvEither<R, E1, B>; /** * @since 0.13.0 * @category Combinator */ export declare const useAllWith: <R, E1, A>(provider: FxEnvEither<R, E1, A>) => <E2, B>(hkt: FxEnvEither<A, E2, B>) => FxEnvEither<R, E1, B>; /** * @since 0.13.0 * @category Combinator */ export declare const provideSomeWith: <R1, E1, A>(provider: FxEnvEither<R1, E1, A>) => P.Provider3<"@typed/fp/Fx/EnvEither", A, R1, E1>; /** * @since 0.13.0 * @category Combinator */ export declare const useSomeWith: <R1, E1, A>(provider: FxEnvEither<R1, E1, A>) => P.Provider3<"@typed/fp/Fx/EnvEither", A, R1, E1>; /** * @since 0.13.0 * @category Combinator */ export declare const askAndUse: <R, E, B>(hkt: FxEnvEither<R, E, B>) => FxEnvEither<R, E, FxEnvEither<unknown, E, B>>; /** * @since 0.13.0 * @category Combinator */ export declare const askAndProvide: <R, E, B>(hkt: FxEnvEither<R, E, B>) => FxEnvEither<R, E, FxEnvEither<unknown, E, B>>; //# sourceMappingURL=FxEnvEither.d.ts.map