{
  "id": 12159048,
  "title": "Changes to STM in Effect 4",
  "url": "https://urgent.news/2026/10/05/changes-to-stm-in-effect-4",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-05T13:30:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/khraks_mamtsov/changes-to-stm-in-effect-4-33c3"
  },
  "original_language": "en",
  "account": "In Effect v3, STM (Software Transactional Memory) operates separately from Effect computations. It is synchronous and pure, meaning it cannot be interrupted during execution. When modifying shared state through transactions, STM maintains a journal of interactions with TRefs, storing a reference to the ref, its initial value, and its current value within the transaction. Upon calling STM.commit, STM checks if the original TRef values remain unchanged. If valid, the changes are applied; otherwise, the transaction restarts. STM's purity allows it to continue until successful commit. However, Effect computations cannot be used inside STM computations, leading to challenges in logging and debugging. Effect v4 streamlines this by integrating STM directly into Effect. The Tx* modules replace STM, utilizing Effect.Transaction to manage transactions. This change enables STM computations to be represented at the type level with Transaction, similar to managing resources with Scope. Effect.Transaction operates implicitly, attached to existing transactions within the context, allowing multiple Tx* operations to be encompassed within a single transaction boundary.",
  "summary": "STM (Software Transactional Memory) is a way to manage concurrent modifications of shared state through transactions, roughly similar to database transactions. Let's say we need to transfer money from one account to another: we need to deduct the amount from one account and add it to the other. Playground — Effect v3 // Effect v3 const program = Effect . gen ( function * () { const alice = yield…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}