Skip to content

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 11 Sep 09:03
· 28 commits to main since this release

Axial 0.9.0

Axial.Layers

Layer.pool provisions a fixed-size set of resource instances and hands them out round-robin through a new
Pool<'resource> type.

let checkerPool =
    Layer.pool 4 (fun _ -> Layer.succeed (FSharpChecker.Create(keepAssemblyContents = true)))

Instances are acquired sequentially, in index order, inside the layer's scope; acquireRelease inside the
acquire function releases each instance in the reverse of that order when the scope closes, same as every other
layer combinator. Pool<'resource>.Next() is a thread-safe round-robin accessor; Pool<'resource>.Count and
Pool<'resource>.Instances expose the provisioned set directly.

This targets expensive, non-thread-safe-per-call resources — compiler services, pinned HTTP clients, and similar —
that were previously hand-rolled per consumer with Interlocked.Increment and a manually sized array.

Prompted by FsLiveDocs adopting Axial for its compile/check pipeline; see
dev-docs/current-ideas/fsharp-compiler-adapter.md.