// ets_tracing: off import "../Operator/index.js" import * as Tp from "@effect-ts/system/Collections/Immutable/Tuple" import { constant, identity } from "@effect-ts/system/Function" import * as X from "@effect-ts/system/XPure" import type { XPureReaderCategoryURI, XPureStateCategoryURI, XPureURI } from "../Modules/index.js" import type { URI } from "../Prelude/index.js" import * as P from "../Prelude/index.js" export type V = P.V<"S", "_"> & P.V<"R", "-"> & P.V<"E", "+"> & P.V<"X", "+"> export const Any = P.instance], V>>({ any: () => X.succeed(constant({})) }) export const Covariant = P.instance], V>>({ map: X.map }) export const AssociativeBoth = P.instance], V>>({ both: X.zip }) export const AssociativeEither = P.instance], V>>({ orElseEither: X.orElseEither }) export const AssociativeFlatten = P.instance], V>>({ flatten: (ffa) => X.chain_(ffa, identity) }) export const Applicative = P.instance], V>>({ ...Any, ...Covariant, ...AssociativeBoth }) export const Access = P.instance], V>>({ access: X.access }) export const Fail = P.instance], V>>({ fail: X.fail }) export const Provide = P.instance], V>>({ provide: X.provideAll }) export const Monad = P.instance], V>>({ ...Any, ...AssociativeFlatten, ...Covariant }) export const StateCategory = P.instance], V>>({ id: () => X.modify((a) => Tp.tuple(a, a)), compose: (bc) => X.chain((_) => bc) }) export const Category = P.instance], V>>({ id: () => X.access(identity), compose: (bc) => (ab) => X.chain_(ab, (b) => X.provideAll_(bc, b)) }) export const struct = P.structF(Applicative) export const tuple = P.tupleF(Applicative) /** * Matchers */ export const { match, matchIn, matchMorph, matchTag, matchTagIn } = P.matchers(Covariant) export * from "@effect-ts/system/XPure"