Hyperlinkv0.8.0-beta.28

TxChunk

TxChunk.sizeconsteffect/TxChunk.ts:469
<A>(self: TxChunk<A>): Effect.Effect<number>

Gets the size of the TxChunk.

Example (Getting the size)

import { Effect, TxChunk } from "effect"

const program = Effect.gen(function*() {
  const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5])

  // Get the current size - automatically transactional
  const currentSize = yield* TxChunk.size(txChunk)
  console.log(currentSize) // 5

  // Size is tracked for conflict detection
  yield* TxChunk.append(txChunk, 6)
  const newSize = yield* TxChunk.size(txChunk)
  console.log(newSize) // 6
})
combinators
Source effect/TxChunk.ts:4692 lines
export const size = <A>(self: TxChunk<A>): Effect.Effect<number> =>
  modify(self, (current) => [Chunk.size(current), current])
Referenced by 1 symbols