Innovenergy_trunk/frontend/node_modules/fp-ts/lib/IORef.d.ts

38 lines
678 B
TypeScript

/**
* Mutable references in the `IO` monad
*
* @since 2.0.0
*/
import { IO } from './IO'
/**
* @example
* import { io } from 'fp-ts/IO'
* import { newIORef } from 'fp-ts/IORef'
*
* assert.strictEqual(io.chain(newIORef(1), ref => io.chain(ref.write(2), () => ref.read))(), 2)
*
* @category model
* @since 2.0.0
*/
export declare class IORef<A> {
private value
/**
* @since 2.0.0
*/
readonly read: IO<A>
constructor(value: A)
/**
* @since 2.0.0
*/
write(a: A): IO<void>
/**
* @since 2.0.0
*/
modify(f: (a: A) => A): IO<void>
}
/**
* @category constructors
* @since 2.0.0
*/
export declare function newIORef<A>(a: A): IO<IORef<A>>