Module

Puregrain.Internal.SelfCheck

Package
purescript-puregrain
Repository
roman-mkh/puregrain

The engine self-check's machinery: the fingerprint of the light curves and its stored reference. Internal: may change without notice. What it checks and why: docs/exact-arithmetic.md, "The engine self-check".

#EngineReport Source

newtype EngineReport

The result of Puregrain.SelfCheck.checkEngine: whether the JavaScript engine computed the light curves exactly as the reference, and if not, what differed.

Constructors

#Digest Source

type Digest = { digest :: Number, name :: String }

One curve's results in one direction, folded into a whole number.

#fingerprint Source

fingerprint :: Unit -> Array Digest

Each computed curve's formulas, both ways, over fixed values and the generator's, each folded into a digest, in referenceDigests' order. Takes unit so that nothing is computed when the module loads.

#referenceDigests Source

referenceDigests :: Array Digest

The reference: the fingerprint as Node 22.14 computed it, the same in Node 26.13, Chromium 156, Firefox 157 and WebKit 27.2 (2026-11-14). It changes only when a curve changes on purpose, in the same commit and with a CHANGELOG line, since every picture dithered with that curve then changes too; never just to make a check pass.

#roundTripProblems Source

roundTripProblems :: Unit -> Array String

A problem for each curve under which a byte doesn't come back exactly from its light, through the table: a check that needs no reference.

#reportFor Source

reportFor :: Array Digest -> Array Digest -> Array String -> EngineReport

The report: the digests that differ from the reference, then the other problems.