/**
* @since 2.0.0
*/
import type * as Option from "./Option.js";
import type { Pipeable } from "./Pipeable.js";
import type * as STM from "./STM.js";
import type * as Types from "./Types.js";
/**
* @since 2.0.0
* @category symbols
*/
export declare const TRefTypeId: unique symbol;
/**
* @since 2.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 2.0.0
* @category models
*/
export interface TRef extends TRef.Variance, Pipeable {
/**
* Note: the method is unbound, exposed only for potential extensions.
*/
modify(f: (a: A) => readonly [B, A]): STM.STM;
}
/**
* @since 2.0.0
*/
export declare namespace TRef {
/**
* @since 2.0.0
*/
interface Variance {
readonly [TRefTypeId]: {
readonly _A: Types.Invariant;
};
}
}
/**
* @since 2.0.0
* @category mutations
*/
export declare const get: (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
export declare const getAndSet: {
/**
* @since 2.0.0
* @category mutations
*/
(value: A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, value: A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const getAndUpdate: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const getAndUpdateSome: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 2.0.0
* @category constructors
*/
export declare const make: (value: A) => STM.STM>;
/**
* @since 2.0.0
* @category mutations
*/
export declare const modify: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => readonly [B, A]): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => readonly [B, A]): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const modifySome: {
/**
* @since 2.0.0
* @category mutations
*/
(fallback: B, f: (a: A) => Option.Option): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, fallback: B, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const set: {
/**
* @since 2.0.0
* @category mutations
*/
(value: A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, value: A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const setAndGet: {
/**
* @since 2.0.0
* @category mutations
*/
(value: A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, value: A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const update: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const updateAndGet: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => A): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => A): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const updateSome: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
/**
* @since 2.0.0
* @category mutations
*/
export declare const updateSomeAndGet: {
/**
* @since 2.0.0
* @category mutations
*/
(f: (a: A) => Option.Option): (self: TRef) => STM.STM;
/**
* @since 2.0.0
* @category mutations
*/
(self: TRef, f: (a: A) => Option.Option): STM.STM;
};
//# sourceMappingURL=TRef.d.ts.map