@matechs/contrib
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -1,2 +0,2 @@ | ||
import * as stateEither from "./StateEither"; | ||
export { stateEither }; | ||
import * as stateEither from "./StateEither" | ||
export { stateEither } |
@@ -1,56 +0,95 @@ | ||
import { CMonad3, CApplicative3 } from "@matechs/core/Base"; | ||
import * as T from "@matechs/core/Effect"; | ||
import * as E from "@matechs/core/Either"; | ||
import * as F from "@matechs/core/Function"; | ||
import * as O from "@matechs/core/Option"; | ||
import * as R from "@matechs/core/Ref"; | ||
import { CMonad3, CApplicative3 } from "@matechs/core/Base" | ||
import * as T from "@matechs/core/Effect" | ||
import * as E from "@matechs/core/Either" | ||
import * as F from "@matechs/core/Function" | ||
import * as O from "@matechs/core/Option" | ||
import * as R from "@matechs/core/Ref" | ||
export interface State<S, A> { | ||
(s: S): [A, S]; | ||
(s: S): [A, S] | ||
} | ||
export declare const StateURI = "@matechs/core/StateEither/StateURI"; | ||
export declare const StateURI = "@matechs/core/StateEither/StateURI" | ||
export interface StateEnv<S> { | ||
[StateURI]: { | ||
state: R.Ref<S>; | ||
}; | ||
[StateURI]: { | ||
state: R.Ref<S> | ||
} | ||
} | ||
export declare const mkState: <S>(_: S) => T.Sync<StateEnv<S>>; | ||
export declare const runToEither: <E, A>(_: T.SyncE<E, A>) => E.Either<E, A>; | ||
export interface StateEither<S, E, A> extends T.SyncRE<StateEnv<S>, E, A> { | ||
} | ||
export declare const evalState: <S, E, A>(ma: StateEither<S, E, A>, s: S) => E.Either<E, A>; | ||
export declare const execState: <S, E, A>(ma: StateEither<S, E, A>, s: S) => E.Either<E, S>; | ||
export declare function left<S, E, A = never>(e: E): StateEither<S, E, A>; | ||
export declare const right: <S, E = never, A = never>(a: A) => StateEither<S, E, A>; | ||
export declare const rightState: <S, E = never, A = never>(ma: State<S, A>) => StateEither<S, E, A>; | ||
export declare function leftState<S, E = never, A = never>(me: State<S, E>): StateEither<S, E, A>; | ||
export declare const get: <S, E = never>() => StateEither<S, E, S>; | ||
export declare const put: <S, E = never>(s: S) => StateEither<S, E, void>; | ||
export declare const modify: <S, E = never>(f: (s: S) => S) => StateEither<S, E, void>; | ||
export declare const gets: <S, E = never, A = never>(f: (s: S) => A) => StateEither<S, E, A>; | ||
export declare const fromEither: <S, E, A>(ma: E.Either<E, A>) => StateEither<S, E, A>; | ||
export declare function fromEitherK<E, A extends Array<unknown>, B>(f: (...a: A) => E.Either<E, B>): <S>(...a: A) => StateEither<S, E, B>; | ||
export declare function chainEitherK<E, A, B>(f: (a: A) => E.Either<E, B>): <S>(ma: StateEither<S, E, A>) => StateEither<S, E, B>; | ||
export declare const URI = "@matechs/core/StateEither"; | ||
export declare type URI = typeof URI; | ||
export declare const mkState: <S>(_: S) => T.Sync<StateEnv<S>> | ||
export declare const runToEither: <E, A>(_: T.SyncE<E, A>) => E.Either<E, A> | ||
export interface StateEither<S, E, A> extends T.SyncRE<StateEnv<S>, E, A> {} | ||
export declare const evalState: <S, E, A>( | ||
ma: StateEither<S, E, A>, | ||
s: S | ||
) => E.Either<E, A> | ||
export declare const execState: <S, E, A>( | ||
ma: StateEither<S, E, A>, | ||
s: S | ||
) => E.Either<E, S> | ||
export declare function left<S, E, A = never>(e: E): StateEither<S, E, A> | ||
export declare const right: <S, E = never, A = never>(a: A) => StateEither<S, E, A> | ||
export declare const rightState: <S, E = never, A = never>( | ||
ma: State<S, A> | ||
) => StateEither<S, E, A> | ||
export declare function leftState<S, E = never, A = never>( | ||
me: State<S, E> | ||
): StateEither<S, E, A> | ||
export declare const get: <S, E = never>() => StateEither<S, E, S> | ||
export declare const put: <S, E = never>(s: S) => StateEither<S, E, void> | ||
export declare const modify: <S, E = never>(f: (s: S) => S) => StateEither<S, E, void> | ||
export declare const gets: <S, E = never, A = never>( | ||
f: (s: S) => A | ||
) => StateEither<S, E, A> | ||
export declare const fromEither: <S, E, A>(ma: E.Either<E, A>) => StateEither<S, E, A> | ||
export declare function fromEitherK<E, A extends Array<unknown>, B>( | ||
f: (...a: A) => E.Either<E, B> | ||
): <S>(...a: A) => StateEither<S, E, B> | ||
export declare function chainEitherK<E, A, B>( | ||
f: (a: A) => E.Either<E, B> | ||
): <S>(ma: StateEither<S, E, A>) => StateEither<S, E, B> | ||
export declare const URI = "@matechs/core/StateEither" | ||
export declare type URI = typeof URI | ||
declare module "@matechs/core/Base/HKT" { | ||
interface URItoKind3<R, E, A> { | ||
[URI]: StateEither<R, E, A>; | ||
} | ||
interface URItoKind3<R, E, A> { | ||
[URI]: StateEither<R, E, A> | ||
} | ||
} | ||
export declare const stateEither: CMonad3<URI> & CApplicative3<URI>; | ||
export declare const ap: <R, E, A>(fa: StateEither<R, E, A>) => <B>(fab: StateEither<R, E, (a: A) => B>) => StateEither<R, E, B>; | ||
export declare const apFirst: <R, E, B>(fb: StateEither<R, E, B>) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
export declare const apSecond: <R, E, B>(fb: StateEither<R, E, B>) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
export declare const chain: <R, E, A, B>(f: (a: A) => StateEither<R, E, B>) => (ma: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
export declare const chainFirst: <R, E, A, B>(f: (a: A) => StateEither<R, E, B>) => (ma: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
export declare const stateEither: CMonad3<URI> & CApplicative3<URI> | ||
export declare const ap: <R, E, A>( | ||
fa: StateEither<R, E, A> | ||
) => <B>(fab: StateEither<R, E, (a: A) => B>) => StateEither<R, E, B> | ||
export declare const apFirst: <R, E, B>( | ||
fb: StateEither<R, E, B> | ||
) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, A> | ||
export declare const apSecond: <R, E, B>( | ||
fb: StateEither<R, E, B> | ||
) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, B> | ||
export declare const chain: <R, E, A, B>( | ||
f: (a: A) => StateEither<R, E, B> | ||
) => (ma: StateEither<R, E, A>) => StateEither<R, E, B> | ||
export declare const chainFirst: <R, E, A, B>( | ||
f: (a: A) => StateEither<R, E, B> | ||
) => (ma: StateEither<R, E, A>) => StateEither<R, E, A> | ||
export declare const filterOrElse: { | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <R>(ma: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>(ma: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
}; | ||
export declare const flatten: <R, E, A>(mma: StateEither<R, E, StateEither<R, E, A>>) => StateEither<R, E, A>; | ||
export declare const fromOption: <E>(onNone: () => E) => <R, A>(ma: O.Option<A>) => StateEither<R, E, A>; | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <R>( | ||
ma: StateEither<R, E, A> | ||
) => StateEither<R, E, B> | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>( | ||
ma: StateEither<R, E, A> | ||
) => StateEither<R, E, A> | ||
} | ||
export declare const flatten: <R, E, A>( | ||
mma: StateEither<R, E, StateEither<R, E, A>> | ||
) => StateEither<R, E, A> | ||
export declare const fromOption: <E>( | ||
onNone: () => E | ||
) => <R, A>(ma: O.Option<A>) => StateEither<R, E, A> | ||
export declare const fromPredicate: { | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <U>(a: A) => StateEither<U, E, B>; | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>(a: A) => StateEither<R, E, A>; | ||
}; | ||
export declare const map: <A, B>(f: (a: A) => B) => <R, E>(fa: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <U>( | ||
a: A | ||
) => StateEither<U, E, B> | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>( | ||
a: A | ||
) => StateEither<R, E, A> | ||
} | ||
export declare const map: <A, B>( | ||
f: (a: A) => B | ||
) => <R, E>(fa: StateEither<R, E, A>) => StateEither<R, E, B> |
@@ -1,2 +0,2 @@ | ||
import * as stateEither from "./StateEither"; | ||
export { stateEither }; | ||
import * as stateEither from "./StateEither" | ||
export { stateEither } |
{ | ||
"name": "@matechs/contrib", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"private": false, | ||
@@ -8,2 +8,5 @@ "license": "MIT", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@matechs/core": "^1.0.0" | ||
}, | ||
"gitHead": "2ff0a2daa194950901aba13f3431b2470889f9c2", | ||
@@ -10,0 +13,0 @@ "main": "./index.js", |
@@ -1,56 +0,95 @@ | ||
import { CMonad3, CApplicative3 } from "@matechs/core/Base"; | ||
import * as T from "@matechs/core/Effect"; | ||
import * as E from "@matechs/core/Either"; | ||
import * as F from "@matechs/core/Function"; | ||
import * as O from "@matechs/core/Option"; | ||
import * as R from "@matechs/core/Ref"; | ||
import { CMonad3, CApplicative3 } from "@matechs/core/Base" | ||
import * as T from "@matechs/core/Effect" | ||
import * as E from "@matechs/core/Either" | ||
import * as F from "@matechs/core/Function" | ||
import * as O from "@matechs/core/Option" | ||
import * as R from "@matechs/core/Ref" | ||
export interface State<S, A> { | ||
(s: S): [A, S]; | ||
(s: S): [A, S] | ||
} | ||
export declare const StateURI = "@matechs/core/StateEither/StateURI"; | ||
export declare const StateURI = "@matechs/core/StateEither/StateURI" | ||
export interface StateEnv<S> { | ||
[StateURI]: { | ||
state: R.Ref<S>; | ||
}; | ||
[StateURI]: { | ||
state: R.Ref<S> | ||
} | ||
} | ||
export declare const mkState: <S>(_: S) => T.Sync<StateEnv<S>>; | ||
export declare const runToEither: <E, A>(_: T.SyncE<E, A>) => E.Either<E, A>; | ||
export interface StateEither<S, E, A> extends T.SyncRE<StateEnv<S>, E, A> { | ||
} | ||
export declare const evalState: <S, E, A>(ma: StateEither<S, E, A>, s: S) => E.Either<E, A>; | ||
export declare const execState: <S, E, A>(ma: StateEither<S, E, A>, s: S) => E.Either<E, S>; | ||
export declare function left<S, E, A = never>(e: E): StateEither<S, E, A>; | ||
export declare const right: <S, E = never, A = never>(a: A) => StateEither<S, E, A>; | ||
export declare const rightState: <S, E = never, A = never>(ma: State<S, A>) => StateEither<S, E, A>; | ||
export declare function leftState<S, E = never, A = never>(me: State<S, E>): StateEither<S, E, A>; | ||
export declare const get: <S, E = never>() => StateEither<S, E, S>; | ||
export declare const put: <S, E = never>(s: S) => StateEither<S, E, void>; | ||
export declare const modify: <S, E = never>(f: (s: S) => S) => StateEither<S, E, void>; | ||
export declare const gets: <S, E = never, A = never>(f: (s: S) => A) => StateEither<S, E, A>; | ||
export declare const fromEither: <S, E, A>(ma: E.Either<E, A>) => StateEither<S, E, A>; | ||
export declare function fromEitherK<E, A extends Array<unknown>, B>(f: (...a: A) => E.Either<E, B>): <S>(...a: A) => StateEither<S, E, B>; | ||
export declare function chainEitherK<E, A, B>(f: (a: A) => E.Either<E, B>): <S>(ma: StateEither<S, E, A>) => StateEither<S, E, B>; | ||
export declare const URI = "@matechs/core/StateEither"; | ||
export declare type URI = typeof URI; | ||
export declare const mkState: <S>(_: S) => T.Sync<StateEnv<S>> | ||
export declare const runToEither: <E, A>(_: T.SyncE<E, A>) => E.Either<E, A> | ||
export interface StateEither<S, E, A> extends T.SyncRE<StateEnv<S>, E, A> {} | ||
export declare const evalState: <S, E, A>( | ||
ma: StateEither<S, E, A>, | ||
s: S | ||
) => E.Either<E, A> | ||
export declare const execState: <S, E, A>( | ||
ma: StateEither<S, E, A>, | ||
s: S | ||
) => E.Either<E, S> | ||
export declare function left<S, E, A = never>(e: E): StateEither<S, E, A> | ||
export declare const right: <S, E = never, A = never>(a: A) => StateEither<S, E, A> | ||
export declare const rightState: <S, E = never, A = never>( | ||
ma: State<S, A> | ||
) => StateEither<S, E, A> | ||
export declare function leftState<S, E = never, A = never>( | ||
me: State<S, E> | ||
): StateEither<S, E, A> | ||
export declare const get: <S, E = never>() => StateEither<S, E, S> | ||
export declare const put: <S, E = never>(s: S) => StateEither<S, E, void> | ||
export declare const modify: <S, E = never>(f: (s: S) => S) => StateEither<S, E, void> | ||
export declare const gets: <S, E = never, A = never>( | ||
f: (s: S) => A | ||
) => StateEither<S, E, A> | ||
export declare const fromEither: <S, E, A>(ma: E.Either<E, A>) => StateEither<S, E, A> | ||
export declare function fromEitherK<E, A extends Array<unknown>, B>( | ||
f: (...a: A) => E.Either<E, B> | ||
): <S>(...a: A) => StateEither<S, E, B> | ||
export declare function chainEitherK<E, A, B>( | ||
f: (a: A) => E.Either<E, B> | ||
): <S>(ma: StateEither<S, E, A>) => StateEither<S, E, B> | ||
export declare const URI = "@matechs/core/StateEither" | ||
export declare type URI = typeof URI | ||
declare module "@matechs/core/Base/HKT" { | ||
interface URItoKind3<R, E, A> { | ||
[URI]: StateEither<R, E, A>; | ||
} | ||
interface URItoKind3<R, E, A> { | ||
[URI]: StateEither<R, E, A> | ||
} | ||
} | ||
export declare const stateEither: CMonad3<URI> & CApplicative3<URI>; | ||
export declare const ap: <R, E, A>(fa: StateEither<R, E, A>) => <B>(fab: StateEither<R, E, (a: A) => B>) => StateEither<R, E, B>; | ||
export declare const apFirst: <R, E, B>(fb: StateEither<R, E, B>) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
export declare const apSecond: <R, E, B>(fb: StateEither<R, E, B>) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
export declare const chain: <R, E, A, B>(f: (a: A) => StateEither<R, E, B>) => (ma: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
export declare const chainFirst: <R, E, A, B>(f: (a: A) => StateEither<R, E, B>) => (ma: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
export declare const stateEither: CMonad3<URI> & CApplicative3<URI> | ||
export declare const ap: <R, E, A>( | ||
fa: StateEither<R, E, A> | ||
) => <B>(fab: StateEither<R, E, (a: A) => B>) => StateEither<R, E, B> | ||
export declare const apFirst: <R, E, B>( | ||
fb: StateEither<R, E, B> | ||
) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, A> | ||
export declare const apSecond: <R, E, B>( | ||
fb: StateEither<R, E, B> | ||
) => <A>(fa: StateEither<R, E, A>) => StateEither<R, E, B> | ||
export declare const chain: <R, E, A, B>( | ||
f: (a: A) => StateEither<R, E, B> | ||
) => (ma: StateEither<R, E, A>) => StateEither<R, E, B> | ||
export declare const chainFirst: <R, E, A, B>( | ||
f: (a: A) => StateEither<R, E, B> | ||
) => (ma: StateEither<R, E, A>) => StateEither<R, E, A> | ||
export declare const filterOrElse: { | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <R>(ma: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>(ma: StateEither<R, E, A>) => StateEither<R, E, A>; | ||
}; | ||
export declare const flatten: <R, E, A>(mma: StateEither<R, E, StateEither<R, E, A>>) => StateEither<R, E, A>; | ||
export declare const fromOption: <E>(onNone: () => E) => <R, A>(ma: O.Option<A>) => StateEither<R, E, A>; | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <R>( | ||
ma: StateEither<R, E, A> | ||
) => StateEither<R, E, B> | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>( | ||
ma: StateEither<R, E, A> | ||
) => StateEither<R, E, A> | ||
} | ||
export declare const flatten: <R, E, A>( | ||
mma: StateEither<R, E, StateEither<R, E, A>> | ||
) => StateEither<R, E, A> | ||
export declare const fromOption: <E>( | ||
onNone: () => E | ||
) => <R, A>(ma: O.Option<A>) => StateEither<R, E, A> | ||
export declare const fromPredicate: { | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <U>(a: A) => StateEither<U, E, B>; | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>(a: A) => StateEither<R, E, A>; | ||
}; | ||
export declare const map: <A, B>(f: (a: A) => B) => <R, E>(fa: StateEither<R, E, A>) => StateEither<R, E, B>; | ||
<E, A, B extends A>(refinement: F.Refinement<A, B>, onFalse: (a: A) => E): <U>( | ||
a: A | ||
) => StateEither<U, E, B> | ||
<E, A>(predicate: F.Predicate<A>, onFalse: (a: A) => E): <R>( | ||
a: A | ||
) => StateEither<R, E, A> | ||
} | ||
export declare const map: <A, B>( | ||
f: (a: A) => B | ||
) => <R, E>(fa: StateEither<R, E, A>) => StateEither<R, E, B> |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17942
405
1
1
+ Added@matechs/core@^1.0.0
+ Added@matechs/core@1.6.0(transitive)
+ Addedfp-ts@2.6.2(transitive)
+ Addedio-ts@2.2.4(transitive)