effect-io-ai

Package: effect
Module: Graph

Graph.mutate

Performs scoped mutations on a graph, automatically managing the mutation lifecycle.

Example

import { Graph } from "effect"

const graph = Graph.directed<string, number>()
const newGraph = Graph.mutate(graph, (mutable) => {
  // Safe mutations go here
  // mutable gets automatically converted back to immutable
})

Signature

declare const mutate: { <N, E, T extends Kind = "directed">(f: (mutable: MutableGraph<N, E, T>) => void): (graph: Graph<N, E, T>) => Graph<N, E, T>; <N, E, T extends Kind = "directed">(graph: Graph<N, E, T>, f: (mutable: MutableGraph<N, E, T>) => void): Graph<N, E, T>; }

Source

Since v3.18.0