TRef
Constructors
Models
Mutations
Signature
declare const get: <A>(self: TRef<A>) => STM.STM<A>;Signature
declare const getAndSet: {
<A>(value: A): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, value: A): STM<A>;
};getAndUpdate
Added in v2.0.0
Source
Signature
declare const getAndUpdate: {
<A>(f: (a: A) => A): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, f: (a: A) => A): STM<A>;
};getAndUpdateSome
Added in v2.0.0
Source
Signature
declare const getAndUpdateSome: {
<A>(f: (a: A) => Option<A>): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, f: (a: A) => Option<A>): STM<A>;
};Signature
declare const modify: {
<A, B>(f: (a: A) => readonly [B, A]): (self: TRef<A>) => STM<B>;
<A, B>(self: TRef<A>, f: (a: A) => readonly [B, A]): STM<B>;
};modifySome
Added in v2.0.0
Source
Signature
declare const modifySome: {
<A, B>(fallback: B, f: (a: A) => Option<readonly [B, A]>): (self: TRef<A>) => STM<B>;
<A, B>(self: TRef<A>, fallback: B, f: (a: A) => Option<readonly [B, A]>): STM<B>;
};Signature
declare const set: {
<A>(value: A): (self: TRef<A>) => STM<void>;
<A>(self: TRef<A>, value: A): STM<void>;
};Signature
declare const setAndGet: {
<A>(value: A): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, value: A): STM<A>;
};Signature
declare const update: {
<A>(f: (a: A) => A): (self: TRef<A>) => STM<void>;
<A>(self: TRef<A>, f: (a: A) => A): STM<void>;
};updateAndGet
Added in v2.0.0
Source
Signature
declare const updateAndGet: {
<A>(f: (a: A) => A): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, f: (a: A) => A): STM<A>;
};updateSome
Added in v2.0.0
Source
Signature
declare const updateSome: {
<A>(f: (a: A) => Option<A>): (self: TRef<A>) => STM<void>;
<A>(self: TRef<A>, f: (a: A) => Option<A>): STM<void>;
};updateSomeAndGet
Added in v2.0.0
Source
Signature
declare const updateSomeAndGet: {
<A>(f: (a: A) => Option<A>): (self: TRef<A>) => STM<A>;
<A>(self: TRef<A>, f: (a: A) => Option<A>): STM<A>;
};Other
Symbols
TRefTypeId
Added in v2.0.0
Source
Signature
declare const TRefTypeId: unique symbol;TRefTypeId type
Added in v2.0.0
Source
Signature
type TRefTypeId = typeof TRefTypeId;
A
TRef<A>is a purely functional description of a mutable reference that can be modified as part of a transactional effect. The fundamental operations of aTRefaresetandget.settransactionally sets the reference to a new value.getgets the current value of the reference.NOTE: While
TRef<A>provides the transactional equivalent of a mutable reference, the value inside theTRefshould be immutable.