packages feed

hydra-typescript 0.17.6 → 0.17.7

raw patch · 4 files changed

+117/−4 lines, 4 filesdep ~hydra-kernelPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hydra-kernel

API changes (from Hackage documentation)

+ Hydra.TypeScript.Coder: decimalDigitsAndScale :: String -> ((String, String), Int)

Files

CHANGELOG.md view
@@ -15,6 +15,88 @@  --- +## [0.17.7] - 2026-09-14++Correctness-hardening point release on the 0.17.x line, consolidating the 0.17.6 breaking batch. It+closes a family of silent cross-host correctness bugs in the equality, ordering, integer-narrowing+and string primitives, and adds the systematic test coverage that exposed them. No kernel-surface+breaking changes.++### Highlights++- **Silent-wrong primitives corrected across hosts**+  ([#745](https://github.com/CategoricalData/hydra/issues/745),+  [#742](https://github.com/CategoricalData/hydra/issues/742)): new shared cross-host fixtures+  uncovered ~a dozen primitives (`equal`/`compare` on collections, float equality, `bigintToIntN`+  narrowing, `parseUint*` bounds, astral-plane string ops) that returned wrong results on one or more+  non-Haskell hosts while appearing to pass. All are now correct and verified per-host against the+  Haskell reference oracle.+- **Systematic test-coverage hardening**+  ([#749](https://github.com/CategoricalData/hydra/issues/749)): new kernel coverage for previously+  untested primitive behavior (equality/ordering collection depth, `notEqual`, `functions.const`/`flip`),+  which drove wiring those primitives into every host's default-implementation fallback.+- **Scale-preserving decimals across every lossy-double host**+  ([#727](https://github.com/CategoricalData/hydra/issues/727),+  [#719](https://github.com/CategoricalData/hydra/issues/719)): `Literal.decimal` gains a real+  scale-preserving representation (coefficient + scale) in the Scheme, Emacs Lisp, Common Lisp and+  TypeScript runtimes and coders, and the generated `Literal.Decimal` `equals`/`compareTo` on Java,+  Python and Scala stop ignoring scale. The `scaleDistinctTestNames` skip list — which had been+  masking the gap on five hosts — is deleted, so decimal scale is now verified everywhere rather+  than excused.++### Bug fixes++- **[#745](https://github.com/CategoricalData/hydra/issues/745)** silent-wrong equality/ordering,+  `bigintToIntN` narrowing, `parseUint32/64` bounds, and astral-plane `charAt`/`splitOn`/`compare`+  across the eight non-Haskell hosts.+- **[#742](https://github.com/CategoricalData/hydra/issues/742)** structural `equal`/`compare` on+  maps, sets and nested decimals no longer falls back to scale-blind or print-based comparison+  (including a hand-inlined Scala primitive that shadowed the overlay fix).+- **[#743](https://github.com/CategoricalData/hydra/issues/743)** kernel JSON decoder now rejects an+  `Either` object carrying both `left` and `right` keys instead of silently resolving one arm.+- **[#740](https://github.com/CategoricalData/hydra/issues/740)** the recursive parametric union decoder+  now emits an explicit type application instead of an untyped lambda, so recursive parametric-union+  types generate and compile on the Java host; also fixes `update-json-kernel` reconcile to build a+  complete inference universe so drifted kernel modules re-infer.+- **[#720](https://github.com/CategoricalData/hydra/issues/720)** Python's+  `hydra.lib.equality`/`ordering` did not satisfy IEEE `totalOrder` for floats, mis-ordering `NaN`+  and signed zero.+- **[#722](https://github.com/CategoricalData/hydra/issues/722)** two `kernelDefaultCoreProfile`+  correctness defects: rule ids that referred to rules no longer present, and a stubbed+  `isValidName` that accepted every name.++### Improvements++- **[#749](https://github.com/CategoricalData/hydra/issues/749)** `notEqual`/`const`/`flip` wired+  into each host's `#609` default-implementation fallback; orphaned Avro coder test suite recovered.+- **[#730](https://github.com/CategoricalData/hydra/issues/730)** a shared `~/.stack` build slot+  (`bin/with-stack-slot.sh`) replaces the pgrep slot mechanic, serializing concurrent GHC builds+  across the fleet behind a real mutex. The wrapper is now portable to macOS: `flock(1)` is+  util-linux and absent there, so it is emulated via Perl's `flock()` where missing, and the+  GNU-only `date -Is`/`date -d` calls are replaced with portable equivalents. Its bypass path also+  no longer re-execs forever. Without these, every entry point that routes through the slot —+  `bin/sync.sh`, `bin/test.sh`, `bin/run-bootstrapping-demo.sh` and `bin/prepare-release.sh` —+  failed immediately on macOS.+- **[#600](https://github.com/CategoricalData/hydra/issues/600)** the five published TypeScript+  packages are subpath-import-only (uniform export surface).+- **[#716](https://github.com/CategoricalData/hydra/issues/716)** `hydra.paths` reshaped onto the+  term-graph model (`TermGraph`/`TypeGraph`), aligning path steps with the term and type grammars+  and adding the link view of a graph; `mapKey`/`mapValue` collapse into a single `mapEntry` step.+- **[#701](https://github.com/CategoricalData/hydra/issues/701)** module cache freshness is now a+  Merkle hash over each module's dependency closure, so a change deep in the closure correctly+  invalidates dependents.+- **[#559](https://github.com/CategoricalData/hydra/issues/559)** host-agnostic build: the+  remaining hand-coded host build logic is promoted into `hydra.build.*`, with Java as the+  definitive second host.+- **[#721](https://github.com/CategoricalData/hydra/issues/721)** `checkNestedModuleNames` packaging+  check enforces the module-namespace no-prefix rule.++### Documentation++- **[#508](https://github.com/CategoricalData/hydra/issues/508)** de-Claude-speak documentation pass:+  style-guide section added, stale paths and dead links repaired, agent-operations wiki pages moved+  into `claude/`, and a `getting-started.md` guardrail against re-adding a TypeScript root export.+ ## [0.17.6] - 2026-08-30  Point release on the 0.17.x line, and the last backward-incompatible batch before the 1.0 surface
hydra-typescript.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           hydra-typescript-version:        0.17.6+version:        0.17.7 synopsis:       Hydra's TypeScript coder: emit TypeScript source from Hydra modules description:    Hydra is an implementation of the LambdaGraph data model, which takes advantage of an isomorphism between labeled hypergraphs and typed lambda calculus: in Hydra, "graphs are programs, and programs are graphs". TypeScript support for Hydra category:       Data@@ -41,6 +41,6 @@   build-depends:       base >=4.19.0 && <4.22     , containers >=0.6.7 && <0.8-    , hydra-kernel ==0.17.6+    , hydra-kernel ==0.17.7     , scientific >=0.3.7 && <0.4   default-language: Haskell2010
src/main/haskell/Hydra/TypeScript/Coder.hs view
@@ -31,6 +31,7 @@ import qualified Hydra.Overlay.Haskell.Lib.Maps as Maps import qualified Hydra.Overlay.Haskell.Lib.Math as Math import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Overlay.Haskell.Lib.Ordering as Ordering import qualified Hydra.Overlay.Haskell.Lib.Pairs as Pairs import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets import qualified Hydra.Overlay.Haskell.Lib.Strings as Strings@@ -109,6 +110,26 @@       let vars = Variables.freeVariablesInTerm t       in (filterNonLocalNames currentNs vars) +-- | Decode a canonical decimal digit string into a ((sign, digits), scale) nested pair+decimalDigitsAndScale :: String -> ((String, String), Int)+decimalDigitsAndScale s =++      let eParts = Strings.splitOn "e" s+          mantissa = Optionals.withDefault "" (Lists.head eParts)+          expText = Optionals.withDefault "" (Lists.head (Lists.drop 1 eParts))+          expTextUnplussed =+                  Logic.ifElse (Equality.equal (Optionals.withDefault 0 (Strings.charAt 0 expText)) 43) (Strings.fromList (Lists.drop 1 (Strings.toList expText))) expText+          expPart = Optionals.withDefault 0 (Literals.parseInt32 expTextUnplussed)+          isNeg = Equality.equal (Optionals.withDefault 0 (Strings.charAt 0 mantissa)) 45+          unsigned = Logic.ifElse isNeg (Strings.fromList (Lists.drop 1 (Strings.toList mantissa))) mantissa+          dotParts = Strings.splitOn "." unsigned+          intPart = Optionals.withDefault "" (Lists.head dotParts)+          fracPart = Optionals.withDefault "" (Lists.head (Lists.drop 1 dotParts))+          rawDigits = Strings.concat2 intPart fracPart+          rawScale = Math.sub (Strings.length fracPart) expPart+          sign = Logic.ifElse isNeg "-" ""+      in (Logic.ifElse (Ordering.lt rawScale 0) ((sign, (Strings.concat2 rawDigits (Strings.fromList (Lists.replicate (Math.negate rawScale) 48)))), 0) ((sign, rawDigits), rawScale))+ -- | Find the free variables of a term that are referenced eagerly, i.e. outside of any nested lambda body; used to break false dependency cycles caused by DSL-level thunks such as hydra.parsers.lazy eagerFreeVariablesInTerm :: Core.Term -> S.Set Core.Name eagerFreeVariablesInTerm term =@@ -179,7 +200,14 @@       in case lit of         Core.LiteralBinary v0 -> strLit (Literals.binaryToBase64 v0)         Core.LiteralBoolean v0 -> boolLit v0-        Core.LiteralDecimal v0 -> numLit (Literals.bigintToInt64 (Literals.decimalToBigint v0))+        Core.LiteralDecimal v0 ->+          let parts = decimalDigitsAndScale (Literals.printDecimal v0)+              signDigits = Pairs.first parts+              scale = Pairs.second parts+              coefficientText = Strings.concat2 (Pairs.first signDigits) (Pairs.second signDigits)+          in (tsObject [+            ("coefficient", (bigIntCall coefficientText)),+            ("scale", (numLit (Literals.bigintToInt64 (Literals.int32ToBigint scale))))])         Core.LiteralString v0 -> strLit v0         Core.LiteralInteger v0 -> case v0 of           Core.IntegerValueBigint v1 -> bigIntCall (Literals.printBigint v1)@@ -204,7 +232,9 @@     case lt of       Core.LiteralTypeBinary -> tsParamApp1 "ReadonlyArray" (tsNamedType "number")       Core.LiteralTypeBoolean -> tsNamedType "boolean"-      Core.LiteralTypeDecimal -> tsNamedType "number"+      Core.LiteralTypeDecimal -> Syntax.TypeExpressionObject [+        tsPropSig "coefficient" False (tsNamedType "bigint"),+        (tsPropSig "scale" False (tsNamedType "number"))]       Core.LiteralTypeFloat v0 -> case v0 of         Core.FloatTypeFloat32 -> tsNamedType "number"         Core.FloatTypeFloat64 -> tsNamedType "number"
src/main/haskell/Hydra/TypeScript/Language.hs view
@@ -72,6 +72,7 @@         Sets.fromList [           Variants.LiteralVariantBinary,           Variants.LiteralVariantBoolean,+          Variants.LiteralVariantDecimal,           Variants.LiteralVariantFloat,           Variants.LiteralVariantInteger,           Variants.LiteralVariantString]