Changelog

Revision history for circuits

0.2.0.0 — 2026-07-20

Total revamp of the API around a single normal-form GADT and a clearer separation between syntax and semantics.

New core vocabulary

  • Circuit.Loop.Loop t arr a b is the free traced monoidal category in normal form: either Lift (a base arrow) or Knot (a feedback loop). Composition fuses via the Category instance, so every value has at most one Knot at the top.
  • Circuit.Free.Free is the free category (Lift, Compose).
  • Circuit.Sym.Sym is the free symmetric monoidal category (Lift, Compose, Par, Swap).
  • Circuit.Net.Net is the free traced PROP with a bimonoid: Lift, Compose, Par, Swap, Knot, Copy, Discard, Plus, Zero. Wiring stays inspectable for transpose, metering, and fusion.
  • Circuit.Hyper.Hyper is the final coinductive encoding; encode and observe move between Loop and Hyper.

Semantics split across two tracks

  • Structural semantics: Circuit.Category.CategoryCircuit.Channel.ChannelCircuit.Channel.StrengthCircuit.Channel.Traced.
  • Functorial semantics: Circuit.Category.CategoryCircuit.Tensor.TensorCircuit.Tensor.Action.

Layer tower

  • Circuit.Layer.Layer unifies the free-forgetful folds: unit, run, bind, lower. Law, Run, and Bind associated types capture what each layer needs from its target and source categories.

Ends, boxes, and queues

  • Circuit.Ends replaces the old Circuit.Box and Circuit.Queue modules. Companion/conjoint ends (Out, In), matched Ends, box, boxAsymmetric, Queue strategies, openSTM, and openIO all live here.

Dagger and bimonoid

  • Circuit.Dagger consolidates CopyDiscard, MergeZero, Bimonoid, Dagger, and transpose.

À-la-carte syntax

  • Circuit.Algebra provides compositional signatures (SigCompose, SigKnot, SigPar, SigSwap, SigBimonoid) and direct GADT ↔︎ syntax isomorphisms (algLoop, runAlgLoop, algNet, runAlgNet).

Operators

  • Forward composition is (.>); backward composition is (.) from Control.Category.
  • Forward/backward application operators (|>) and (<|) live in Circuit.Category.

Removed

  • Circuit.Trace / Circuit GADT name retired to Circuit.Loop.
  • Circuit.Strength, Circuit.Monoidal, Circuit.Classes, Circuit.Adjunction, Circuit.Signature, Circuit.Box, Circuit.Queue, Circuit.Loopd, and Circuit.Dup are gone; their contents are merged or renamed as above.
  • cellIO, openCollectSTM, openCollectIO, openBatchSTM, openBatchMaybeSTM, freeToMon, monTranspose, AlgSymKnot, loopToSymKnot, and the old traceToAlg / algToTrace names are removed. Helpers that are not core API moved to circuits-examples.
  • The signature-tests Cabal test suite is removed; verification is via cabal-docspec and cabal check.

Examples and companion libraries

  • Example cards moved to the separate circuits-examples repository.
  • Circuit.AD moved to the circuits-ad package.