packages feed

proarrow-0.4.0.0: CHANGELOG.md

# Revision history for proarrow

## Unreleased

## 0.4.0.0 -- 2026-10-23

* `Proarrow.Tools.SMC`:
  * `Proarrow.Tools.CCC` now uses SMC syntax, contexts, patterns and binders in `PROD k`.
  * `TermP p`, terms whose computations are arrows of a promonad `p`, compiled by `proc`;
    `Term` is `TermP (~>)`.
  * `toSMC1` and `toCCC1` infer embedded input and output objects from the surrounding morphism type.
  * Tuple patterns, binds and tuples of five and six; `liftF` applies a morphism to a term or
    tuple of terms and embeds its result by `F`, allowing the result object to be inferred.
    Its infix form `(-<)` and `returnA`, an alias for the identity morphism, mirror
    Haskell's arrow notation. All three are also available in `Proarrow.Tools.CCC`.
  * Arrow application and tuple construction reuse variables across binds without explicit depth casts;
    `TupleDepth` is removed.
  * `ifThenElse`, an alias for `caseOf`, supports sum elimination with `RebindableSyntax`
    in SMC and CCC: `if x then \l -> ... else \r -> ...`.
  * `(!)` also accepts embedded function objects, including results of `(-<)`, in SMC and CCC.
  * Computation binds accept embedded dual objects as continuation results, allowing `(-<)` there.
  * Scalar multiplication accepts `F Unit`, including results of `(-<)`.
  * A Yampa feedback-echo example and `smc-audio` executable render dry and echoed WAV files
    and a string diagram from the same SMC network. The GitHub Pages documentation build
    includes the audio files for listening from the wiki.
* `Proarrow.Profunctor.Instance.Star`: `Costrong Tensor (Star (Prelude m))` for `MonadFix m`,
  supporting feedback through SMC's `loop` and recursive `do`.
* Decorated cospans, including open hypergraphs, now support traced SMC notation.
* `Proarrow.Category.Instance.OpenHypergraph`: graph substitution with optional wire-sort expansion.
  `readBack` and `simplify` now take a `Wiring`, supporting symmetric monoidal, copy/discard
  and Frobenius structure, with optional tracing via `tracedWith`.
  `frobeniusWith` replaces `readBackWith` and `simplifyWith`; `simplifyHypergraph` provides
  total read-back for primitive graphs in hypergraph targets.
  `prim0` through `prim3` lift ordinary arrows as boxes with zero to three inputs and one output.
* `OpenHypergraph` read-back reduces swap cost, including within contraction trees; `layered` exposes parallel tensor layers.
* An SMC build pipeline demonstrates automatic parallel scheduling, with executable builds and measured timelines.
* `Proarrow.Tools.ContractionOrder`: `planContraction`, the order to contract a network of factors
  in, the cheaper of numpy's greedy order and a min-fill elimination order (`minFillOrder`). The
  read-back of open hypergraphs, and with it einsum, and tensor networks contract along it.
  `Proarrow.Category.Instance.OpenHypergraph`: `simplifyFlat`, which bends every box into a state
  first, so the whole network is contracted in that order.
* `Proarrow.Category.Instance.TensorNetwork`: `matMul`, a product of matrices given as vectors,
  through BLAS when the `blas` flag is on; the dagger copies no entries, and complex ones are
  conjugated once, when first needed.
* `Proarrow.Tools.Optic`: compile SMC programs of optics to forward/backward computations
  through graph substitution, requiring only symmetric monoidal structure in the target.
* `Proarrow.Optic.Action`: `runMonoidalOptic` connects a tensor-action optic's forward and
  backward passes into one computation.
* `Proarrow.Category.Instance.Circuit` and `Simulator`: typed digital circuits with clocked
  simulation and Verilog generation, plus an SMC counter demo.
* Wiki walkthroughs of the digital counter and parallel build examples, linked from the README.
* `Proarrow.Category.Instance.Diff`: `DIFF`, differentiable maps with their reverse derivatives
* SVG diagrams declare UTF-8 encoding for standalone viewers.
* `Proarrow.Squares`: orient data flow rightward, add matching horizontal/vertical helpers and pointwise evaluation,
  and explore optics as square programs.
* Applicative `Star (Prelude f)` effects now support `Prostrong TravFl`.
* `Proarrow.Object`: `withKnownAppend` and `withKnownAssoc`, the `KnownListOf` evidence of appended lists.
* `Proarrow.Testing`: `TestableType` and `TestingEqShow` for `Corep`.

## 0.3.0.0 -- 2026-10-10

* `Proarrow.Tools.Einsum`: `einsum @"ij,jk->ik" a b` on tensors in hypergraph categories.
* `Proarrow.Tools.SMC`: index notation for categories whose index types are `Frobenius`: `sumOver`
  binds a summed index, `delta` is the Kronecker delta, and `*^`/`^*` multiply by a scalar term.
* `Proarrow.Tools.SMC` no longer uses linear types: a variable used more than once is copied
  (`CocommutativeComonoid`) and an unused one is discarded (`Comonoid`). `with` takes two terms and
  `caseOf` the scrutinee and two branches, sharing the variables around them. `call` and `closed`
  are removed.
* `Proarrow.Tools.SMC` is split into multiple internal modules.
* `Proarrow.Category.Instance.DecoratedCospan`: `DECCOSPAN f`, cospans whose apex carries an
  `Alternative` decoration, a hypergraph category.
* `Proarrow.Category.Instance.Cospan`: `COSPAN k` is `DECCOSPAN` with the `Undecorated` decoration.
* `Proarrow.Category.Instance.OpenHypergraph`: open hypergraphs with typed wires.
* `Proarrow.Category.Monoidal.Hypergraph`: `Sized`, the size of an object (a dimension, a number of
  elements), which the read-back of open hypergraphs and `einsum` choose their contraction order by.
* `Proarrow.Category.Instance.TensorNetwork`: `TNET e`, matrices kept as tensor networks over lists of
  dimensions, a hypergraph category whose structure costs nothing; `einsum` in it contracts pairwise.
  `Scalar`, the entry types, with a contraction loop compiled for each, which hands matrix products of
  `Double`, `Float` and `Complex Double` entries to the system's BLAS with the new `blas` flag.
  Biproducts as direct sums, the dagger, distributivity and traces, as in `Mat`; entries in and out as
  storable vectors (`fromVector`, `toVector`) or lists of rows.
* `Proarrow.Category.Instance.FinHask`: `unionFind`, the representatives after joining pairs, used by the
  coequalizers of `FINHASK` and `FINSET`.
* `Proarrow.Optic.Iso`: `DecidableIso`, categories that decide whether two objects are isomorphic,
  with the isomorphism as an optic of any flavour; instances for `Mat`, `FinRel`, `SVG` and `DOT`.
* `Proarrow.Object`: `ListOf c xs`, a type-level list with the evidence `c` for each element as a
  value, with `KnownListOf`. It replaces the library's own list singletons:
  * `Strictified`: `SList` is removed; `sList` is a `ListOf Ob'`.
  * `Thin`: `FNil`/`FCons` are now `Nil`/`Cons`, and `HasFiniteDefault` is removed (`finite`
    defaults to `listOf`).
  * `Edges`: `ENil`/`ECons` are removed.
* `Proarrow.Object`: `SomeOf c`, a type with the evidence `c` known only at runtime, built with
  `Some @a`. In `Proarrow.Testing`, `Some k` is `SomeOf TestOb'`, and `MkSomeList` is replaced by
  `mkSomeList`.
* `Proarrow.Optic.Kaleidoscope`, `Proarrow.Optic.Grate`: kaleidoscopes and grates now need
  `CocommutativeComonoid m` instead of `Comonoid m`.
* `Proarrow.Category.Monoidal.Applicative`: `Alternative`'s superclass is `HasBinaryCoproducts j` and
  `Monoidal k` instead of `Distributive j`.
* `Proarrow.Optic.Traversal`: `fromTravVL` builds a `Traversal` from a Prelude traversal, with `Baz`
  as the witness.
* `Proarrow.Category.Monoidal.Distributive`: `Traversing`, a new component of
  `StrongDistributiveProfunctor`, and `Traversable (CorepStar t)`. Eliminating a traversal with an
  unbounded witness through the generic carrier no longer loops. The `Traversable` witness
  instances need `Distributive k` and `CopyDiscard k` instead of `Bicartesian k`.
* `Proarrow.Profunctor.Instance.Star`: `Traversable (Star (Prelude g))`;
  `Strong CoprodAction (Star f)` for any strong lax monoidal `f` and `Strong ProdAction (Star f)`
  for any functor on `Type`.
* `Proarrow.Tools.Diagrams.Svg`: the option `bendSpiders` draws a merge point followed by a discard
  point as a cap, and a unit point followed by a copy point as a cup; `slidePoints` moves unit and
  discard points next to what uses or makes their wire.
* `Proarrow.Category.Instance.Linear`: `CocommutativeComonoid (L (Ur a))` and
  `CocommutativeComonoid (L Bool)`.

## 0.2.0.0 -- 2026-10-04

* New `Proarrow.Tools.SMC`: linear HOAS for symmetric monoidal categories, with `do` notation,
  traces, duals, additives, and polarised System L inputs and outputs (`Consumer`, `Command`,
  `cut`, `cont`, `ret`, `classical`, the shifts `Up a = Not (Not a)` and `Dn` with `thunk` and
  `force`, and `recast` between type expressions for one object; a `do` bind of an `Up` runs it)
  over any dialogue category. With optimisation a compiled term is the category's own structure
  maps, composed.
* New `Proarrow.Category.Instance.Cps`: a closed symmetric monoidal category with a chosen answer
  object as a dialogue category, `Dual a = a ~~> r`. With `r = IO ()` this is call by push value;
  see the `Examples.Cbpv` test module. It is isomix exactly when `r` is the unit (`answerUnit`).
* New `Proarrow.Category.Monoidal.Dialogue`, now the superclass of `StarAutonomous`: `Dual`,
  `dual`, `linDist`, `linDistInv`, `doubleNegInv`, `Par` and its functions, `DualF` and the
  related helpers move there, with their laws (`DialogueStructures`, `testDialogue`, witness
  `DialogueW`). `StarAutonomous` keeps `dualInv`, `doubleNeg` and `ExpSA`. Instances split
  accordingly. New: `tripleNeg` and `bindDual`.
* New `Proarrow.Category.Monoidal.IsoMix`: dialogue categories with `Dual Unit ≅ Unit`
  (`dualUnit`, `dualUnitInv`, `dualityCounit`). It is a superclass of `CompactClosed`, which
  loses `dualUnit` and `dualityCounit` and lists `StarAutonomous` itself. `LINEAR` is isomix.
* `Proarrow.Testing` has `check`, which fails with a message unless a condition holds.
* GHC 9.14 support
  * `Testable` no longer has the quantified superclass `forall a. (TestOb a) => Ob' a`.
    `obFromTestOb` is now a `Testable` method instead, defaulting to the identity when `TestOb` is
    `Ob`; instances with their own `TestOb` define it (usually `obFromTestOb r = r`), and calls
    take the kind first (`obFromTestOb @_ @a`). `testObFromOb` is the converse.
  * `Proarrow.Testing` has `withTestOb2Def`, `withTestObProdDef`, `withTestObCoprodDef`,
    `withTestObExpDef` and `withTestObDualDef`, the objecthood witnesses for when `TestOb` is `Ob`.
  * `Functor` no longer has the quantified superclass `forall a. Ob a => Ob' (f a)`: `withObF`
    gives `Ob (f a)`.
  * The associativity superclass of `Strictly` no longer asks for `Ob b` and `Ob c`.
* Fixed: in `LINEAR`, `doubleNeg`, `dualInv` and the par eliminators returned stale values when
  compiled with optimisation, because every call of `dn` shared one reference.
* Fixed: in the Int construction, the tensor of morphisms, the associators, `linDist`,
  `linDistInv` and `distribDual` looped forever. The Int construction over `FinRel` is now
  law-tested.

## 0.1.0.0 -- 2026-09-28

* First release