Thanks to visit codestin.com
Credit goes to effect-ts.github.io

Skip to main content Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

TSet.ts overview

Since v2.0.0


Exports Grouped by Category


constructors

empty

Makes an empty TSet.

Signature

declare const empty: <A>() => STM.STM<TSet<A>>

Source

Since v2.0.0

fromIterable

Creates a new TSet from an iterable collection of values.

Signature

declare const fromIterable: <A>(iterable: Iterable<A>) => STM.STM<TSet<A>>

Source

Since v2.0.0

make

Makes a new TSet that is initialized with specified values.

Signature

declare const make: <Elements extends Array<any>>(...elements: Elements) => STM.STM<TSet<Elements[number]>>

Source

Since v2.0.0

destructors

toArray

Collects all elements into a Array.

Signature

declare const toArray: <A>(self: TSet<A>) => STM.STM<Array<A>>

Source

Since v2.0.0

toChunk

Collects all elements into a Chunk.

Signature

declare const toChunk: <A>(self: TSet<A>) => STM.STM<Chunk.Chunk<A>>

Source

Since v2.0.0

toHashSet

Collects all elements into a HashSet.

Signature

declare const toHashSet: <A>(self: TSet<A>) => STM.STM<HashSet.HashSet<A>>

Source

Since v2.0.0

toReadonlySet

Collects all elements into a ReadonlySet.

Signature

declare const toReadonlySet: <A>(self: TSet<A>) => STM.STM<ReadonlySet<A>>

Source

Since v2.0.0

elements

forEach

Atomically performs transactional-effect for each element in set.

Signature

declare const forEach: {
  <A, R, E>(f: (value: A) => STM.STM<void, E, R>): (self: TSet<A>) => STM.STM<void, E, R>
  <A, R, E>(self: TSet<A>, f: (value: A) => STM.STM<void, E, R>): STM.STM<void, E, R>
}

Source

Since v2.0.0

has

Tests whether or not set contains an element.

Signature

declare const has: {
  <A>(value: A): (self: TSet<A>) => STM.STM<boolean>
  <A>(self: TSet<A>, value: A): STM.STM<boolean>
}

Source

Since v2.0.0

folding

reduce

Atomically folds using a pure function.

Signature

declare const reduce: {
  <Z, A>(zero: Z, f: (accumulator: Z, value: A) => Z): (self: TSet<A>) => STM.STM<Z>
  <Z, A>(self: TSet<A>, zero: Z, f: (accumulator: Z, value: A) => Z): STM.STM<Z>
}

Source

Since v2.0.0

reduceSTM

Atomically folds using a transactional function.

Signature

declare const reduceSTM: {
  <Z, A, R, E>(zero: Z, f: (accumulator: Z, value: A) => STM.STM<Z, E, R>): (self: TSet<A>) => STM.STM<Z, E, R>
  <Z, A, R, E>(self: TSet<A>, zero: Z, f: (accumulator: Z, value: A) => STM.STM<Z, E, R>): STM.STM<Z, E, R>
}

Source

Since v2.0.0

getters

isEmpty

Tests if the set is empty or not

Signature

declare const isEmpty: <A>(self: TSet<A>) => STM.STM<boolean>

Source

Since v2.0.0

size

Returns the set’s cardinality.

Signature

declare const size: <A>(self: TSet<A>) => STM.STM<number>

Source

Since v2.0.0

models

TSet (interface)

Transactional set implemented on top of TMap.

Signature

export interface TSet<in out A> extends TSet.Variance<A> {}

Source

Since v2.0.0

mutations

add

Stores new element in the set.

Signature

declare const add: { <A>(value: A): (self: TSet<A>) => STM.STM<void>; <A>(self: TSet<A>, value: A): STM.STM<void> }

Source

Since v2.0.0

difference

Atomically transforms the set into the difference of itself and the provided set.

Signature

declare const difference: {
  <A>(other: TSet<A>): (self: TSet<A>) => STM.STM<void>
  <A>(self: TSet<A>, other: TSet<A>): STM.STM<void>
}

Source

Since v2.0.0

intersection

Atomically transforms the set into the intersection of itself and the provided set.

Signature

declare const intersection: {
  <A>(other: TSet<A>): (self: TSet<A>) => STM.STM<void>
  <A>(self: TSet<A>, other: TSet<A>): STM.STM<void>
}

Source

Since v2.0.0

remove

Removes a single element from the set.

Signature

declare const remove: { <A>(value: A): (self: TSet<A>) => STM.STM<void>; <A>(self: TSet<A>, value: A): STM.STM<void> }

Source

Since v2.0.0

removeAll

Removes elements from the set.

Signature

declare const removeAll: {
  <A>(iterable: Iterable<A>): (self: TSet<A>) => STM.STM<void>
  <A>(self: TSet<A>, iterable: Iterable<A>): STM.STM<void>
}

Source

Since v2.0.0

removeIf

Removes entries from a TSet that satisfy the specified predicate and returns the removed entries (or void if discard = true).

Signature

declare const removeIf: {
  <A>(predicate: Predicate<A>, options: { readonly discard: true }): (self: TSet<A>) => STM.STM<void>
  <A>(predicate: Predicate<A>, options?: { readonly discard: false }): (self: TSet<A>) => STM.STM<Array<A>>
  <A>(self: TSet<A>, predicate: Predicate<A>, options: { readonly discard: true }): STM.STM<void>
  <A>(self: TSet<A>, predicate: Predicate<A>, options?: { readonly discard: false }): STM.STM<Array<A>>
}

Source

Since v2.0.0

retainIf

Retains entries in a TSet that satisfy the specified predicate and returns the removed entries (or void if discard = true).

Signature

declare const retainIf: {
  <A>(predicate: Predicate<A>, options: { readonly discard: true }): (self: TSet<A>) => STM.STM<void>
  <A>(predicate: Predicate<A>, options?: { readonly discard: false }): (self: TSet<A>) => STM.STM<Array<A>>
  <A>(self: TSet<A>, predicate: Predicate<A>, options: { readonly discard: true }): STM.STM<void>
  <A>(self: TSet<A>, predicate: Predicate<A>, options?: { readonly discard: false }): STM.STM<Array<A>>
}

Source

Since v2.0.0

takeFirst

Takes the first matching value, or retries until there is one.

Signature

declare const takeFirst: {
  <A, B>(pf: (a: A) => Option.Option<B>): (self: TSet<A>) => STM.STM<B>
  <A, B>(self: TSet<A>, pf: (a: A) => Option.Option<B>): STM.STM<B>
}

Source

Since v2.0.0

takeFirstSTM

Takes the first matching value, or retries until there is one.

Signature

declare const takeFirstSTM: {
  <A, B, E, R>(pf: (a: A) => STM.STM<B, Option.Option<E>, R>): (self: TSet<A>) => STM.STM<B, E, R>
  <A, B, E, R>(self: TSet<A>, pf: (a: A) => STM.STM<B, Option.Option<E>, R>): STM.STM<B, E, R>
}

Source

Since v2.0.0

takeSome

Takes all matching values, or retries until there is at least one.

Signature

declare const takeSome: {
  <A, B>(pf: (a: A) => Option.Option<B>): (self: TSet<A>) => STM.STM<[B, ...Array<B>]>
  <A, B>(self: TSet<A>, pf: (a: A) => Option.Option<B>): STM.STM<[B, ...Array<B>]>
}

Source

Since v2.0.0

takeSomeSTM

Takes all matching values, or retries until there is at least one.

Signature

declare const takeSomeSTM: {
  <A, B, E, R>(pf: (a: A) => STM.STM<B, Option.Option<E>, R>): (self: TSet<A>) => STM.STM<[B, ...Array<B>], E, R>
  <A, B, E, R>(self: TSet<A>, pf: (a: A) => STM.STM<B, Option.Option<E>, R>): STM.STM<[B, ...Array<B>], E, R>
}

Source

Since v2.0.0

transform

Atomically updates all elements using a pure function.

Signature

declare const transform: {
  <A>(f: (a: A) => A): (self: TSet<A>) => STM.STM<void>
  <A>(self: TSet<A>, f: (a: A) => A): STM.STM<void>
}

Source

Since v2.0.0

transformSTM

Atomically updates all elements using a transactional function.

Signature

declare const transformSTM: {
  <A, R, E>(f: (a: A) => STM.STM<A, E, R>): (self: TSet<A>) => STM.STM<void, E, R>
  <A, R, E>(self: TSet<A>, f: (a: A) => STM.STM<A, E, R>): STM.STM<void, E, R>
}

Source

Since v2.0.0

union

Atomically transforms the set into the union of itself and the provided set.

Signature

declare const union: {
  <A>(other: TSet<A>): (self: TSet<A>) => STM.STM<void>
  <A>(self: TSet<A>, other: TSet<A>): STM.STM<void>
}

Source

Since v2.0.0

symbols

TSetTypeId

Signature

declare const TSetTypeId: unique symbol

Source

Since v2.0.0

TSetTypeId (type alias)

Signature

type TSetTypeId = typeof TSetTypeId

Source

Since v2.0.0

utils

TSet (namespace)

Source

Since v2.0.0

Variance (interface)

Signature

export interface Variance<in out A> {
  readonly [TSetTypeId]: {
    readonly _A: Types.Invariant<A>
  }
}

Source

Since v2.0.0