// ets_tracing: off import type * as Tp from "@effect-ts/system/Collections/Immutable/Tuple" import * as F from "@effect-ts/system/XPure" import type { XReader } from "./definition.js" /** * Lift a sync (non failable) computation */ export const succeedWith: (f: () => A) => XReader = F.succeedWith /** * Reads the current context */ export const environment = (): XReader => F.environment() /** * Projects a value from the global context in a Reader */ export const access: (f: (r: R) => A) => XReader = F.access /** * Changes the value of the local context during the execution of the action `ma` */ export const provideSome: ( f: (d: Q) => R ) => (ma: XReader) => XReader = F.provideSome /** * Combines this computation with the specified computation. */ export const zip: ( fb: XReader ) => (fa: XReader) => XReader> = F.zip /** * Extends this computation with another computation that depends on the * result of this computation by running the first computation, using its * result to generate a second computation, and running that computation. */ export const chain: ( f: (a: A) => XReader ) => (self: XReader) => XReader = F.chain /** * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` * whose argument and return types use the type constructor `F` to represent * some computational context. */ export const map: (f: (a: A) => B) => (self: XReader) => XReader = F.map /** * Succeed with a value A */ export const succeed: (a: A) => XReader = F.succeed /** * Run the computation */ export const run = (self: XReader): A => F.run(self) /** * Run the computation with environment R */ export const runEnv = (r: R) => (self: XReader): A => F.run(F.provideAll_(self, r)) /** * Returns a computation that effectfully "peeks" at the success of this one. */ export const tap: ( f: (a: A) => XReader ) => (self: XReader) => XReader = F.tap