/**
* @since 1.0.0
*/
import type * as Option from "@effect/data/Option";
import type * as STM from "@effect/stm/STM";
/**
* @since 1.0.0
* @category symbols
*/
export declare const TRefTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbols
*/
export type TRefTypeId = typeof TRefTypeId;
/**
* A `TRef` is a purely functional description of a mutable reference that can
* be modified as part of a transactional effect. The fundamental operations of
* a `TRef` are `set` and `get`. `set` transactionally sets the reference to a
* new value. `get` gets the current value of the reference.
*
* NOTE: While `TRef` provides the transactional equivalent of a mutable
* reference, the value inside the `TRef` should be immutable.
*
* @since 1.0.0
* @category models
*/
export interface TRef extends TRef.Variance {
/**
* Note: the method is unbound, exposed only for potential extensions.
*/
modify(f: (a: A) => readonly [B, A]): STM.STM;
}
/**
* @since 1.0.0
*/
export declare namespace TRef {
/**
* @since 1.0.0
*/
interface Variance {
readonly [TRefTypeId]: {
readonly _A: (_: never) => A;
};
}
}
/**
* @since 1.0.0
* @category mutations
*/
export declare const get: (self: TRef) => STM.STM;
/**
* @since 1.0.0
* @category mutations
*/
export declare const getAndSet: {
(value: A): (self: TRef) => STM.STM;
(self: TRef, value: A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const getAndUpdate: {
(f: (a: A) => A): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const getAndUpdateSome: {
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const make: (value: A) => STM.STM>;
/**
* @since 1.0.0
* @category mutations
*/
export declare const modify: {
(f: (a: A) => readonly [B, A]): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => readonly [B, A]): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const modifySome: {
(fallback: B, f: (a: A) => Option.Option): (self: TRef) => STM.STM;
(self: TRef, fallback: B, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const set: {
(value: A): (self: TRef) => STM.STM;
(self: TRef, value: A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const setAndGet: {
(value: A): (self: TRef) => STM.STM;
(self: TRef, value: A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const update: {
(f: (a: A) => A): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const updateAndGet: {
(f: (a: A) => A): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const updateSome: {
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 1.0.0
* @category mutations
*/
export declare const updateSomeAndGet: {
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
//# sourceMappingURL=TRef.d.ts.map