// ets_tracing: off
import "../Operator/index.js"
import * as T from "@effect-ts/system/Effect"
import * as I from "../Identity/index.js"
import type { EffectCategoryURI, EffectURI } from "../Modules/index.js"
import * as DSL from "../Prelude/DSL/index.js"
import type { URI } from "../Prelude/index.js"
import * as P from "../Prelude/index.js"
export * from "@effect-ts/system/Effect"
export { EffectURI } from "../Modules/index.js"
export type V = P.V<"R", "-"> & P.V<"E", "+">
export const Any = P.instance
], V>>({
any: () => T.succeed({})
})
export const AssociativeEither = P.instance], V>>({
orElseEither: T.orElseEither
})
export const AssociativeFlatten = P.instance], V>>(
{
flatten: T.flatten
}
)
export const AssociativeBoth = P.instance], V>>({
both: T.zip
})
export const Covariant = P.instance], V>>({
map: T.map
})
export const IdentityFlatten = P.instance], V>>({
...Any,
...AssociativeFlatten
})
export const IdentityBoth = P.instance], V>>({
...Any,
...AssociativeBoth
})
export const Monad = P.instance], V>>({
...IdentityFlatten,
...Covariant
})
export const Applicative = P.instance], V>>({
...Covariant,
...IdentityBoth
})
export const Fail = P.instance], V>>({
fail: T.fail
})
export const Run = P.instance], V>>({
either: T.either
})
export const Access = P.instance], V>>({
access: T.access
})
export const Provide = P.instance], V>>({
provide: T.provideAll
})
export const getValidationApplicative = DSL.getValidationF<[URI], V>({
...Monad,
...Run,
...Fail,
...Applicative
})
export const Category = P.instance], V>>({
id: T.environment,
compose: T.compose
})
/**
* Matchers
*/
export const { match, matchIn, matchMorph, matchTag, matchTagIn } =
DSL.matchers(Covariant)
/**
* Derive sequential identity
*/
export function getIdentity(Id: I.Identity) {
return (): I.Identity> =>
I.makeIdentity(T.succeed(Id.identity) as T.Effect, (x, y) =>
T.zipWith_(x, y, Id.combine)
)
}
/**
* Derive parallel identity
*/
export function getIdentityPar(Id: I.Identity) {
return (): I.Identity> =>
I.makeIdentity(T.succeed(Id.identity) as T.Effect, (x, y) =>
T.zipWithPar_(x, y, Id.combine)
)
}