tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

commit 1e847d672e27cc17baf593e52b1b39919166a915
parent e35b1b1a16b71422e03f71aadfd524f99fdac32b
Author: James Eversole <james@eversole.co>
Date:   Tue, 13 Oct 2026 21:01:54 -0500

Publish verified compiler closure and relocate patterns to support

Accepted fresh stable pair for source e35b1b1: 27 identical module manifests, 875 distinct complete trees, exact reproduction of all three bundles, and 12 generation-two native/program smokes. Rebuilt all 39 support modules and reproduced their complete receipt-bound manifests. Support v3 permits only explicit, rebuilt patterns relocation; arbitrary membership and retained-source changes still fail. Fixture freshness, shipped compiler/kit verification and Nix fast gate pass. Application compiler bytes remain unchanged. Retained acceptance and preparation: .bootstrap-run/io-dependency-cleanup/. Demo-site compiler refresh follows using this committed fixture publication.

Diffstat:
Mbootstrap/rebuild/bootstrap-kit.json | 4++--
Mbootstrap/stable-compiler-source-map.v1 | 3+--
Mbootstrap/stable-compiler.json | 18++++++------------
Mdocs/validation.md | 11++++++++---
Mtest/Spec.hs | 25+++++++++++++++++++++----
Mtest/SupportFixture.hs | 22++++++++++++++++++++--
Mtest/bootstrap_archive.py | 2+-
Mtest/fixture_sources.py | 3++-
Mtest/fixtures/compiler-library.arboricx | 0
Mtest/fixtures/compiler-library.v1 | 5++---
Atest/fixtures/reference-source/c4ec206590d25d581b9a96f242c22936d8d0b2e9903331ce50b30ad7de254bd6.tri | 184+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtest/fixtures/support-library.arboricx | 0
Mtest/fixtures/support-library.v1 | 13++++++++-----
Mtest/fixtures/support-rebuilt.arboricx | 0
Mtest/fixtures/support-receipts/demos_patternMatching.receipt | 2+-
Atest/fixtures/support-receipts/patterns.manifest | 5+++++
Atest/fixtures/support-receipts/patterns.receipt | 160+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtest/native_library_migration.py | 2+-
Mtest/repair_support_fixture.py | 28++++++++++++++++++++++++++--
Mtest/unit.py | 17+++++++++++++++++
20 files changed, 465 insertions(+), 39 deletions(-)

diff --git a/bootstrap/rebuild/bootstrap-kit.json b/bootstrap/rebuild/bootstrap-kit.json @@ -1,8 +1,8 @@ { "schema": "tricu.bootstrap-kit.v1", "backend": "stable", - "accepted_source": "8f98f2a5cd63d6b3f66614556049fb30d0d2c5ce", - "source_map_sha256": "28a9ec518d69c0498897e7a7d2cb1e353fb502c3dbe379aac4c74fd64844dbfa", + "accepted_source": "e35b1b1a16b71422e03f71aadfd524f99fdac32b", + "source_map_sha256": "3a412a3046cb8e1cd83914d1e5f33b2e573684230670b3098b38790bbde12065", "artifacts": { "compiler": { "file": "rebuilt-compiler.arboricx", diff --git a/bootstrap/stable-compiler-source-map.v1 b/bootstrap/stable-compiler-source-map.v1 @@ -2,7 +2,7 @@ arboricx.source-map.v1 native source_map source.map lib/source/map.tri prelude,io,source_object,source_module,source_resolve,source_build native source_unit source.unit lib/source/unit.tri prelude,parser,source_order,source_compile,source_program,source_resolve,source_ast,source_stable native prelude prelude lib/prelude.tri base,bytes,conversions -native io io lib/io.tri base,patterns +native io io lib/io.tri base native source_object source.object lib/source/object.tri prelude,io,native_math native source_module source.module lib/source/module.tri prelude,io,source_object,source_unit,source_resolve,source_lexer,parser native source_resolve source.resolve lib/source/resolve.tri prelude,parser,source_parser,source_ast,source_lexer,source_core,source_equations,source_pattern @@ -15,7 +15,6 @@ native source_ast source.ast lib/source/ast.tri prelude,source_lexer native base base lib/base.tri native_math native bytes bytes lib/bytes.tri base native conversions conversions lib/conversions.tri base,native_math -native patterns patterns lib/patterns.tri base native source_lexer source.lexer lib/source/lexer.tri prelude,parser,lexer,native_math native source_parser source.parser lib/source/parser.tri prelude,parser,source_lexer,source_ast,source_equations native source_core source.core lib/source/core.tri prelude diff --git a/bootstrap/stable-compiler.json b/bootstrap/stable-compiler.json @@ -5,9 +5,9 @@ "sha256": "5d36d069562ca9b208cfd0aa8df9f0d3b5c39f8b13e070fb892e21b38e32ffb4", "export": "sourceBuildGraph", "published_fixture_export": "source_build.sourceBuildGraphStable", - "accepted_source": "8f98f2a5cd63d6b3f66614556049fb30d0d2c5ce", + "accepted_source": "e35b1b1a16b71422e03f71aadfd524f99fdac32b", "source_map": "bootstrap/stable-compiler-source-map.v1", - "source_map_sha256": "28a9ec518d69c0498897e7a7d2cb1e353fb502c3dbe379aac4c74fd64844dbfa", + "source_map_sha256": "3a412a3046cb8e1cd83914d1e5f33b2e573684230670b3098b38790bbde12065", "sources": [ { "alias": "source_map", @@ -30,8 +30,8 @@ { "alias": "io", "path": "lib/io.tri", - "snapshot": "test/fixtures/reference-source/1d79ec9eec9e14abbf8a44c9bd577e4a2a3f371a4f05d93fc711024d45d46543.tri", - "sha256": "46205b9163d4ef00d39d71cfedc616330965ccd1b5e3f8c2ca51a1ef8c423450" + "snapshot": "test/fixtures/reference-source/c4ec206590d25d581b9a96f242c22936d8d0b2e9903331ce50b30ad7de254bd6.tri", + "sha256": "1fd5bf8f19d0729d4df86775772e2ec00d4aff42e7483bd71b7eafb906d5857e" }, { "alias": "source_object", @@ -106,12 +106,6 @@ "sha256": "e5459b1ab4f81b0777629402755bd06cda70562aceae242205d178963eb41354" }, { - "alias": "patterns", - "path": "lib/patterns.tri", - "snapshot": "test/fixtures/reference-source/d61f2de7b3dce93c9b8914fb980224437d0ea4207787caab9098041cf5bfe896.tri", - "sha256": "1ee56047615897acf1f2c450ab37c5a659b63079c21f85e3d1b5737c38310f4b" - }, - { "alias": "source_lexer", "path": "lib/source/lexer.tri", "snapshot": "test/fixtures/reference-source/94ee3a70dbed59015891f7f5c2ef588d64f1a885218edc35eed98d96d85fd11b.tri", @@ -180,8 +174,8 @@ ], "acceptance": { "fresh_generations": 2, - "matching_manifests": 28, - "distinct_complete_trees": 878, + "matching_manifests": 27, + "distinct_complete_trees": 875, "matching_bundle_sha256": "5d36d069562ca9b208cfd0aa8df9f0d3b5c39f8b13e070fb892e21b38e32ffb4", "matching_artifacts": { "rebuilt-compiler.arboricx": "f25bf1c3fc81fd81bc4b4e994872fde1845fbbd88714774c236c9b59c80dee01", diff --git a/docs/validation.md b/docs/validation.md @@ -355,8 +355,8 @@ rather than preserving malformed legacy Maybe results. ## Support fixture publication -Support fixture v2 retains immutable original compiler/support snapshots and -per-module provenance. Its 38-module reference cohort has stable-rebuilt native +Support fixture v3 retains immutable original compiler/support snapshots and +per-module provenance. Its 39-module reference cohort has stable-rebuilt native receipts, full manifests, and a separate compiled-root snapshot. Original snapshots are not relabeled as outputs of another compiler. Rebuilt modules may change bodies and exports: their source fingerprints must match the actual compiled @@ -399,7 +399,12 @@ against their own source bytes, compiler identities, and receipts; no compilatio is implied by repacking them. Include genuinely rebuilt affected consumers in the selection: stale support dependency pins fail before metadata is published. Cohort membership/alias/path changes remain a separate operation; source and -export compatibility are not requirements for rebuilt modules. +export compatibility are not requirements for rebuilt modules. The explicit +`--relocate-patterns` operation adds only `patterns` at `lib/patterns.tri`, requires +its genuine native rebuild, and refuses publication while it still belongs to +the compiler fixture. V3 records this relocation without changing the immutable +origin membership. Use that option when publishing the current 39-module support +set; ordinary candidate replacement still cannot add arbitrary modules. Current indexed native-manifest reproduction uses indexed import and exact manifest comparison. Reproducing retained flat manifests expands trees: its diff --git a/test/Spec.hs b/test/Spec.hs @@ -11,7 +11,7 @@ import Research import TreeObservation (forceTreeShared) import qualified NodeTable as Nodes import Wire -import SupportFixture (verifyMixedSupport, verifyReuseScopes, verifySupportSources, +import SupportFixture (verifyMixedSupport, verifyReuseScopes, verifySupportSources, verifyRelocatedSupportSources, verifySupportExports, verifySupportDependencies, readFixtureSourceBytes, readTestSource, readPinnedSource) import ContentStore import ContentStore.Bundle @@ -3763,7 +3763,7 @@ supportFixture = unsafePerformIO $ do metadata <- lines <$> readFile "./test/fixtures/support-library.v1" bytes <- BS.readFile "./test/fixtures/support-library.arboricx" compilerBytes <- BS.readFile "./test/fixtures/compiler-library.arboricx" - unless (take 1 metadata `elem` [["tricu.support-library-fixture.v1"], ["tricu.support-library-fixture.v2"]]) $ + unless (take 1 metadata `elem` [["tricu.support-library-fixture.v1"], ["tricu.support-library-fixture.v2"], ["tricu.support-library-fixture.v3"]]) $ error "invalid support fixture metadata" let rows = [(legacy, alias, path, digest) | row <- tail metadata, ["module", legacy, alias, path, digest] <- [words row]] @@ -3772,7 +3772,7 @@ supportFixture = unsafePerformIO $ do error "support fixture bundle digest mismatch" unless (["compiler-fixture", objectHash "tricu.compiler-library-fixture.v1" compilerBytes] `elem` map words metadata) $ error "support fixture dependency mismatch" - if take 1 metadata == ["tricu.support-library-fixture.v2"] + if take 1 metadata `elem` [["tricu.support-library-fixture.v2"], ["tricu.support-library-fixture.v3"]] then verifyMixedSupport metadata bytes compilerBytes else pure () _ <- evaluate (length (fst compilerFixture)) @@ -4007,7 +4007,11 @@ digestHexTests = testGroup "guarded digest hex" compilerFixtureTests :: TestTree compilerFixtureTests = testGroup "self-built reference compiler fixture" [ testCase "matches all recorded reference source inputs" $ do - length (fst compilerFixture) @?= 28 + length (fst compilerFixture) @?= 27 + assertBool "fixture-only patterns still in compiler closure" + (all (\(_, alias, _) -> alias /= "patterns") (fst compilerFixture)) + assertBool "patterns missing from support cohort" + (any (\(_, alias, _) -> alias == "patterns") (fst supportFixture)) assertBool "missing unit compiler export" (Map.member "source_unit.compileSource" (snd compilerFixture)) , testCase "every reference compiler module authors native headers" $ do @@ -4100,6 +4104,19 @@ compilerFixtureTests = testGroup "self-built reference compiler fixture" Left "retained source fingerprint changed: http" verifySupportSources old [["module","other","http","lib/http.tri","new-source"]] (Set.singleton "http") @?= Left "support cohort identity changed" + , testCase "compiler-to-support relocation requires exact identity and a rebuild" $ do + let old = [["module","http","http","lib/http.tri","old-source"]] + added = ["module","patterns","patterns","lib/patterns.tri","new-source"] + declared = ["relocated","compiler-library","patterns","patterns","lib/patterns.tri"] + current = old ++ [added, declared] + verifyRelocatedSupportSources old current (Set.singleton "patterns") @?= Right () + forM_ [old ++ [added], old ++ [added, declared, declared], + old ++ [added, declared, ["module","extra","extra","lib/extra.tri","pin"]], + old ++ [["module","patterns","patterns","lib/other.tri","pin"], declared]] $ \bad -> + assertBool "unauthorized relocation accepted" + (case verifyRelocatedSupportSources old bad (Set.singleton "patterns") of Left _ -> True; _ -> False) + verifyRelocatedSupportSources old current Set.empty @?= Left "invalid patterns cohort relocation" + verifySupportSources old current (Set.singleton "patterns") @?= Left "support cohort identity changed" , testCase "rebuilt export sets follow the new manifest, not the old interface" $ do let manifest kind names = unlines ("arboricx.module-manifest.v1" : ["export " ++ name ++ " " ++ kind ++ " hash arboricx.abi.tree.v1" | name <- names]) diff --git a/test/SupportFixture.hs b/test/SupportFixture.hs @@ -1,7 +1,7 @@ -- Test-only mixed-origin fixture verification. No source compilation/evaluation: -- parse/freeVars, exact DAG interning, complete namespaces, receipt authentication. module SupportFixture (verifyMixedSupport, verifyReuseScopes, verifySupportSources, - verifySupportExports, verifySupportDependencies, canonicalEnvs, + verifySupportExports, verifySupportDependencies, verifyRelocatedSupportSources, canonicalEnvs, readFixtureSourceBytes, readTestSource, readPinnedSource) where import Eval (freeVars) @@ -137,6 +137,21 @@ verifySupportSources original current rebuilt = do _ -> Left "invalid support source row" where require ok message = if ok then Right () else Left message +-- One explicitly authorized cohort move. Ordinary identity/reuse validation +-- stays unchanged; the added module must have a genuine native rebuild receipt. +verifyRelocatedSupportSources :: [[String]] -> [[String]] -> S.Set String -> Either String () +verifyRelocatedSupportSources original current rebuilt = do + let added = [row | row@["module",_,"patterns",_,_] <- current] + declarations = [row | row <- current, take 1 row == ["relocated"]] + unless (declarations == [["relocated","compiler-library","patterns","patterns","lib/patterns.tri"]] && + "patterns" `S.member` rebuilt && + all (\row -> take 4 row /= ["module","patterns","patterns","lib/patterns.tri"]) original) $ + Left "invalid patterns cohort relocation" + case added of + [row@["module","patterns","patterns","lib/patterns.tri",_]] -> + verifySupportSources (original ++ [row]) current rebuilt + _ -> Left "invalid patterns cohort relocation" + -- The export set belongs to the new authenticated native manifest, not the -- historical module. Do not lose the full-set check when allowing API changes. verifySupportExports :: S.Set String -> String -> Either String () @@ -204,7 +219,10 @@ verifyMixedSupport metadata currentBytes compilerBytes = do S.fromList [takeWhile (/= '.') name | name <- M.keys ns] == aliases && S.fromList [takeWhile (/= '.') name | name <- M.keys rebuilt] == built) $ error "invalid mixed support cohort partition/export set" - either error pure (verifySupportSources oldRows (map words metadata) built) + either error pure $ + if take 1 metadata == ["tricu.support-library-fixture.v3"] + then verifyRelocatedSupportSources oldRows (map words metadata) built + else verifySupportSources oldRows (map words metadata) built forM_ [ (alias,path) | ["module",_,alias,path,_] <- map words metadata] $ \(alias,path) -> if alias `S.member` reused then do unless (owned ns alias == owned os alias) $ error ("retained output changed: " ++ alias) diff --git a/test/bootstrap_archive.py b/test/bootstrap_archive.py @@ -255,7 +255,7 @@ is made. Keep the complete transfer directory together and copy it off-machine. Frozen source commit: {a.seed_commit} Both fresh-store stable generations completed and independently audited all -28 mapped compiler modules. Generation 2 executed generation 1's rebuilt compiler +{len(acceptance['inputs'][1]['sources'])} mapped compiler modules. Generation 2 executed generation 1's rebuilt compiler and reproduced executable manifests and all three packaged artifacts exactly. See acceptance.json and the original inputs/status/invocation/logs in both stores. No paths in that original provenance have been rewritten. diff --git a/test/fixture_sources.py b/test/fixture_sources.py @@ -22,7 +22,8 @@ def source_rows(fixtures): lines = (fixtures / (cohort + '.v1')).read_text().splitlines() versions = {'tricu.' + cohort + '-fixture.v1'} if cohort == 'support-library': - versions.add('tricu.support-library-fixture.v2') + versions.update(('tricu.support-library-fixture.v2', + 'tricu.support-library-fixture.v3')) if not lines or lines[0] not in versions: raise ValueError('unsupported fixture metadata: ' + cohort) bundle = (fixtures / (cohort + '.arboricx')).read_bytes() diff --git a/test/fixtures/compiler-library.arboricx b/test/fixtures/compiler-library.arboricx Binary files differ. diff --git a/test/fixtures/compiler-library.v1 b/test/fixtures/compiler-library.v1 @@ -2,7 +2,7 @@ tricu.compiler-library-fixture.v1 module source.map source_map lib/source/map.tri 72638c3d2ec6f47598cba67c730249e8381c67cd5ba6437c4d24711e206afced module source.unit source_unit lib/source/unit.tri df06fabda353c5d88c0463e63f3d260c584abf0258ff2e3b9ca500481f4e0658 module prelude prelude lib/prelude.tri 0c26a0142d15cc2a11a4317264491c797944e76ea8afa07a1efef240a70f4289 -module io io lib/io.tri 1d79ec9eec9e14abbf8a44c9bd577e4a2a3f371a4f05d93fc711024d45d46543 +module io io lib/io.tri c4ec206590d25d581b9a96f242c22936d8d0b2e9903331ce50b30ad7de254bd6 module source.object source_object lib/source/object.tri 76a7e0ddde50e8a600ae8855d9091aa59af3235193605e5a7a07532ae90372af module source.module source_module lib/source/module.tri fb609a75a12659d2a05a63681c0cf96ef606045b4aebe044eac077c8cd23fbf2 module source.resolve source_resolve lib/source/resolve.tri bbb524d3e08a9961f8de6d8e2ab2e7dd47576b8ed78676a64d997bf65133b543 @@ -15,7 +15,6 @@ module source.ast source_ast lib/source/ast.tri b6d05cace61c04032ea39a858dedc748 module base base lib/base.tri 7ba2537cc4ec0571a7aa8a02557551245ca04f5bc08d9f9c1eb4d2606ec67b37 module bytes bytes lib/bytes.tri 6d057be42bc16788a34ce80cca7cb97251cf7dbbae8fd57100a31206ab3dd2a0 module conversions conversions lib/conversions.tri fd93454ad6cf7b0d906f367bed9a679f7f7e73cf424e33d8a62e63b023db6522 -module patterns patterns lib/patterns.tri d61f2de7b3dce93c9b8914fb980224437d0ea4207787caab9098041cf5bfe896 module source.lexer source_lexer lib/source/lexer.tri 94ee3a70dbed59015891f7f5c2ef588d64f1a885218edc35eed98d96d85fd11b module source.parser source_parser lib/source/parser.tri 00d64064122dace90dd8fa8535e4f9a76450bc61de572ae40f4a05692aeac9a0 module source.core source_core lib/source/core.tri b132ca49c22098c8a5d638517d701ad8141028d9389594ac2134240d240a2637 @@ -27,4 +26,4 @@ module source.pattern source_pattern lib/source/pattern.tri 1d43992c04f9881c1ebd module source.equations source_equations lib/source/equations.tri 825f175f5c6dd56e103b94e924283acf5913cbc4554fb42fc07a034f460d2076 module source.stable source_stable lib/source/stable.tri d52a595e2a4ab187b3d13b478b98a596d83b02fdeae0818c58a105b7a1d14c97 module math.native native_math lib/math/native.tri 3ee81d8c129a511ddb26b34d22ebc4fe257fb124a99e2b2f1afce8a1b3087009 -bundle 28eff5a74e5c2fdc8d38eb0332331684188ec40214bce4a1a4006c7e343e9c52 +bundle 42ef859ea271315a2b2687226773af32739030e419e105c36d4dc3742c979e6e diff --git a/test/fixtures/reference-source/c4ec206590d25d581b9a96f242c22936d8d0b2e9903331ce50b30ad7de254bd6.tri b/test/fixtures/reference-source/c4ec206590d25d581b9a96f242c22936d8d0b2e9903331ce50b30ad7de254bd6.tri @@ -0,0 +1,184 @@ +!import base * +!export * + +-- IO constructors for host-interpreted interaction trees. +-- Free-monad style: Bind is the single sequencing mechanism. + +version = 1 + +io = action : pair "tricuIO" (pair version action) + +pure = x : pair 0 x +bind = action k : pair 1 (pair action k) +-- Terminal diagnostic control for the Haskell IO scheduler. +abortIO = diagnostic : pair 2 diagnostic + +putStr = s : pair 10 s +getLine = pair 11 t + +-- Source boundary only: Result (raw octets, Unicode scalar list), strict UTF-8. +-- Initial BOM is rejected; binary readFile remains unchanged. +readSourceFile = p : pair 37 p +encodeSourceText = chars : pair 38 chars + +readFile = p : pair 20 p +writeFile = p c : pair 21 (pair p c) +putBytes = bs : pair 12 bs +writeBytes = p c : pair 22 (pair p c) + +listDirectory = p : pair 23 p +renameFile = old new : pair 24 (pair old new) +createDirectory = p : pair 25 p +deleteFile = p : pair 26 p +fileExists = p : pair 27 p + +sha256Hex = bs : pair 28 bs +currentTime = pair 29 t +-- Filesystem-only atomic primitives. writeBytesIfAbsent returns ok true +-- for a new object and ok false if the path already exists, without changing +-- it. atomicWriteBytes returns ok true after atomic replacement of an alias. +-- Hosts sync file contents before publication and the parent directory +-- afterwards. Publish referenced objects before replacing a lock or alias; +-- a post-publication sync failure can leave the new name visible. +writeBytesIfAbsent = p bs : pair 32 (pair p bs) +atomicWriteBytes = p bs : pair 33 (pair p bs) + +-- Read-permitted canonical tree-term transport. Verify the fixed +-- arboricx.tree-term.v1 digest before decoding; returns Result tree. +-- This loads an inert normal-form tree, never source or an applied program. +readTreeTerm = p digest : pair 34 (pair p digest) + +-- Fixed canonical tree-term domain. No byte-list marshalling. Publication +-- requires read and write permission, never replaces an existing path, and +-- verifies its bytes even when another publisher wins. Directories are explicit. +hashTreeTerm = tree : pair 35 tree +writeTreeTermIfAbsent = p digest tree : pair 36 (pair p (pair digest tree)) + +-- Name-neutral indexed DAG transport under arboricx.indexed-tree.v1. +-- These primitive codecs preserve sharing; tricu chooses paths and publication +-- order. Read verifies before decode; write verifies an existing/racing winner. +-- Both read and write permission are required for no-replace publication. +readIndexedTree = p digest : pair 50 (pair p digest) +hashIndexedTree = tree : pair 51 tree +writeIndexedTreeIfAbsent = p digest tree : pair 52 (pair p (pair digest tree)) + +ask = pair 30 t +local = f action : pair 31 (pair f action) + +get = pair 40 t +put = s : pair 41 s + +fork = action : pair 60 action +await = handle : pair 61 handle +yield = pair 62 t +sleep = ms : pair 63 ms + +-- --------------------------------------------------------------------------- +-- Generic sequencing combinators +-- --------------------------------------------------------------------------- + +thenIO = a b : bind a (_ : b) +mapIO = action f : bind action (x : pure (f x)) +void = action : bind action (_ : pure t) + +-- --------------------------------------------------------------------------- +-- Conditional execution +-- --------------------------------------------------------------------------- + +when = cond action : matchBool action (pure t) cond +unless = cond action : matchBool (pure t) action cond + +-- --------------------------------------------------------------------------- +-- Infinite loop +-- --------------------------------------------------------------------------- + +forever action = bind action (_ : forever action) + +-- --------------------------------------------------------------------------- +-- Result-aware combinators +-- --------------------------------------------------------------------------- + +-- Propagate driver Result on error; run okCase on success. +onOk action okCase = (do bind + reply <- action + matchResult (_ _ : pure reply) okCase reply) + +-- Value-only adapter: success remainder is explicitly discarded. +onOk_ action okCase = onOk action (value _ : okCase value) + +onResult action errCase okCase = (do bind + reply <- action + matchResult errCase okCase reply) + +-- Value-only handlers explicitly discard both Result remainders. +onResult_ action errCase okCase = (onResult action + (message _ : errCase message) + (value _ : okCase value)) + +mapErrIO prefix action = + onResult_ action + (e : pure (err (append prefix e) t)) + (v : pure (ok v t)) + +-- --------------------------------------------------------------------------- +-- Convenience helpers +-- --------------------------------------------------------------------------- + +print = s : void (putStr s) +putStrLn = s : void (putStr (append s "\n")) + +-- --------------------------------------------------------------------------- +-- Result-aware file helpers +-- --------------------------------------------------------------------------- + +onReadFile = path : onResult (readFile path) + +onWriteFile = path contents : onResult (writeFile path contents) + +onListDirectory = path : onResult (listDirectory path) +onRenameFile = old new : onResult (renameFile old new) +onCreateDirectory = path : onResult (createDirectory path) +onDeleteFile = path : onResult (deleteFile path) +onFileExists = path : onResult (fileExists path) +onSha256Hex = bs : onResult (sha256Hex bs) +onCurrentTime = onResult currentTime + +-- --------------------------------------------------------------------------- +-- Convenience helpers for the common cases +-- --------------------------------------------------------------------------- + +readFileOrPrintError = (path okCase : + onReadFile path + (err rest : putStrLn (append "Read failed: " err)) + okCase) + +writeFileOrPrintError = (path contents okCase : + onWriteFile path contents + (err rest : putStrLn (append "Write failed: " err)) + okCase) + +copyFile = (src dst : + onResult (readFile src) + (err rest : putStrLn (append "Read failed: " err)) + (contents rest : + onResult (writeFile dst contents) + (err rest : putStrLn (append "Write failed: " err)) + (_ _ : pure t))) + +-- --------------------------------------------------------------------------- +-- Ordinary-completion cleanup (not exception masking or abort recovery) +-- --------------------------------------------------------------------------- + +-- Run cleanup once after action returns any ordinary value/Result, including +-- failure; ignore cleanup's ordinary result and preserve the action's result. +-- Terminal abortIO, divergence and host exceptions can prevent cleanup. +finally action cleanup = (do bind + result <- action + cleanup + pure result) + +-- Acquisition returns a Result. Failure propagates unchanged without use or +-- release; success supplies the resource value (not the Result envelope). +-- Use the same ordinary-completion/cleanup-result policy as finally. +bracket acquire release use = (onOk_ acquire + (resource : finally (use resource) (release resource))) diff --git a/test/fixtures/support-library.arboricx b/test/fixtures/support-library.arboricx Binary files differ. diff --git a/test/fixtures/support-library.v1 b/test/fixtures/support-library.v1 @@ -1,4 +1,4 @@ -tricu.support-library-fixture.v2 +tricu.support-library-fixture.v3 module socket socket lib/socket.tri 5014c5c41aa63d3b8a52e6cd89600b435505d93325f730b532c9eabaffd58421 module intensional intensional lib/intensionalContracts.tri 4b9470311bb8984bf311371c6b1c056ac971e073c60be5a433a5826780c31d38 module binary binary lib/binary.tri 6dcf2f2087adef04a9b60330563c58c782ab51678622fafdbd7c7a6b14d20483 @@ -37,11 +37,13 @@ module source.staged-list-experiment source_staged_list_experiment lib/source/st module source.staged-conditional-experiment source_staged_conditional_experiment lib/source/staged-conditional-experiment.tri 989783bbdb71be5447803503f60925672ff29fad15804da31c8f7f83b8c402ad module tests.stagingExperiment tests_stagingExperiment test/stagingExperiment.tri 7a5a63f29ea34723bf72330c66f6c4b1b9a9a58988c5b8bd2d04ca9ab861fb03 module tests.stagedConditionalRunner tests_stagedConditionalRunner test/stagedConditionalRunner.tri 9f9f7c11a470595fa8d92933219bdb7653bc5ff647eff7afc352504e0c29eb66 -compiler-fixture 28eff5a74e5c2fdc8d38eb0332331684188ec40214bce4a1a4006c7e343e9c52 +module patterns patterns lib/patterns.tri d61f2de7b3dce93c9b8914fb980224437d0ea4207787caab9098041cf5bfe896 +relocated compiler-library patterns patterns lib/patterns.tri +compiler-fixture 42ef859ea271315a2b2687226773af32739030e419e105c36d4dc3742c979e6e origin-metadata f7c9bdccb402d1b7ea41f7a63b2e78e18546d2129ad25faed7b3871663d91c0a origin-compiler 91b04273bf18429028e12a35126fc98fbad82911a2699a8937379573908ca78d origin-support f15f1e3740e5639e1fb08877ad2bf27af9758c74e468fae474d5ec4a71894b85 -rebuilt-support 74390ad6a2dcd6c1893b76488a3da3d0a0e6f500228e4b76bdc1105718d84491 +rebuilt-support 9f372ebdcd33a7a4ead94e59b4172505652e84d160d4b60eb0e7d6f6537b24b7 rebuilt socket 52b99c25ce8adfef43951a4cfa072bed5d2bd33af1d4f43b4bd6afeb0e9b79ef 80ea1dc6c48f0ec753f8c640ec20354215eb1d337ac6c942c9f040f80280578f 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt intensional 350fff3fbf88943a99396dd69b7f4b760956b201e92159b375f4250ce976584c 9be22e7d68fddc1bbce1454c9fd78cd00eaaa5139a5534148941c893de48cae4 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt binary 14417f14282cc5fddfde90ad9529da22f5bb54c9b351272a59e274ac214051be 89273ee209a5e49b57193fab642f25f51a46885b11ce10af3951d8ef4d321bfe 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 @@ -57,7 +59,7 @@ rebuilt source_export_cache 237b342cec5bd107e83091ef445f5cad275177deba254d6aa670 rebuilt demos_equality 5e75edef7dc116c59b9a763e21f8026f0a8ef339569e1e354a95e525e35933f0 b9838c100442d949c4308b3b65a934826102d70055f758d2d48da708a072fd46 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt demos_size 795f14c212798f1080c31532496cad4d8078a2ccba5f44d7c9f28350e5b3b4b1 fe6a2f74099abae65031687c36892d31a1a6655445c3e1094aa835f8e74c5282 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt demos_toSource 441ef83ecbebedb81ff23b8f3d7a007615981e75abceeb79dfbafbbe0de3c439 9847180a88cd53f67554bdf12d898c8ce93a1f1c7a0f64afdfc9100d32c13809 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 -rebuilt demos_patternMatching ce59b2e17498978e837dd854f586a37289e4f83c97ee0724173904b3908e36cc 59dd026133d956675185e99768395d35752dc9bbaaaac6c7d6aae3db3b5c03a3 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 +rebuilt demos_patternMatching c1b5478d11465b8e7c09f89a0e629ef59e1f12fb382721339798ba7d0ef2b827 59dd026133d956675185e99768395d35752dc9bbaaaac6c7d6aae3db3b5c03a3 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt demos_levelOrderTraversal f6b13f329fff1f9090a00f47e86bcbda78bfb235e4793b1ecb0f50ab0bec49b2 026e3277f03b8e740a516426d3747cca778476e519bdfb814c602f50ce164853 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt demos_contractEffects d09a669f39c8c44659041f45bb088488f27a3e4f7c4e161c5eae1419cce15019 7d1ddbded37d31546b9003a2a3c315fe39edce4f7788bee2430a18d493677454 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt demos_interactionTrees 199c2058a204b5cf48c918c88522475c5945ac74f8cb0e4ce18759f84995c745 29748c0902625b523879edf3facf645136471929da55f12fda7e81ec01b428af 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 @@ -80,4 +82,5 @@ rebuilt source_staged_list_experiment 7757a3b6667fd1899aae7185db785a63af82b167ce rebuilt source_staged_conditional_experiment 084dbb5638501ca68c1f781d44f3139625728c61e9aeb7085563741955d60b4d 0935bb1ced11b4f101b9dcc19ae3fc111e2b7f2bb48d11dfb82ced6d8fef7715 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt tests_stagingExperiment 2a41a7f8067d75711a8f1dc8279b0dac287a25f9e3efd36a62ae85b840bd2643 abdb75cd9116088a2ece22275c2f63214d4c99e8a1cb67660008566916f777ee 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 rebuilt tests_stagedConditionalRunner 9f19baba6b5dc0b8048f25b0f6b1dff6b8adb61a9f594460e255f8dc36624e25 097e3c97e88a5c9ce205ff48e82e47e48281c2077d28b6e46904d859f7fc254a 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 -bundle 74390ad6a2dcd6c1893b76488a3da3d0a0e6f500228e4b76bdc1105718d84491 +rebuilt patterns 5c9572d26cd1d96db21c58f6df60a1402ed563aa2bdbeae395cea455dc0c665d 16d074eda39e963b6aa931d9aa1cc7b01d94bf3203a9a75c26d194f7026f2232 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 +bundle 9f372ebdcd33a7a4ead94e59b4172505652e84d160d4b60eb0e7d6f6537b24b7 diff --git a/test/fixtures/support-rebuilt.arboricx b/test/fixtures/support-rebuilt.arboricx Binary files differ. diff --git a/test/fixtures/support-receipts/demos_patternMatching.receipt b/test/fixtures/support-receipts/demos_patternMatching.receipt @@ -4,7 +4,7 @@ compiler 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 options 307cf2eafa67562f5c3a6d4555c1fc1ccb9b91f43d0b74d564f5aa0bb73ffd0f output 59dd026133d956675185e99768395d35752dc9bbaaaac6c7d6aae3db3b5c03a3 local prelude fb9fa3a808de88b00f70f2021573fe887bff5db9f73f07ecc377043c54726f76 9defd372faa4cb8b6696b8f0672ed4a4f0a1d86788fe815043a2de8a7829eb48 -local patterns 16d074eda39e963b6aa931d9aa1cc7b01d94bf3203a9a75c26d194f7026f2232 28ae28ef79f069ea15ef38bd191a99381d8f4c4c33282bddc96e0750244d9472 +local patterns 16d074eda39e963b6aa931d9aa1cc7b01d94bf3203a9a75c26d194f7026f2232 5c9572d26cd1d96db21c58f6df60a1402ed563aa2bdbeae395cea455dc0c665d pin prelude fb9fa3a808de88b00f70f2021573fe887bff5db9f73f07ecc377043c54726f76 false 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 pin prelude fb9fa3a808de88b00f70f2021573fe887bff5db9f73f07ecc377043c54726f76 _ 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 pin prelude fb9fa3a808de88b00f70f2021573fe887bff5db9f73f07ecc377043c54726f76 true 2177bae1081d12a6f888b5efc89a27616aaf6e5df019f156a0f3d4c2d14bb270 diff --git a/test/fixtures/support-receipts/patterns.manifest b/test/fixtures/support-receipts/patterns.manifest @@ -0,0 +1,5 @@ +arboricx.module-manifest.v1 +export match arboricx.indexed-tree.v1 392cad37cb197d09c4c44763a8ca785185345dcc337d5c0e299b89a7bb36061d arboricx.abi.tree.v1 +export otherwise arboricx.indexed-tree.v1 80b537dfb7561820e33acc1a1c9e2139c91b221d5ba823247f353af87bb9c13a arboricx.abi.tree.v1 +export cond arboricx.indexed-tree.v1 d08c19eadaf4e6ca0eddb4046eeebebf372bdecde5ba1b0d54fac15c33ff44f5 arboricx.abi.tree.v1 +export guard arboricx.indexed-tree.v1 9eb87416a3b3c05d71b0b54f03c669366aa728956389f73093f258d510959986 arboricx.abi.tree.v1 diff --git a/test/fixtures/support-receipts/patterns.receipt b/test/fixtures/support-receipts/patterns.receipt @@ -0,0 +1,160 @@ +arboricx.build-receipt.v1 +source d61f2de7b3dce93c9b8914fb980224437d0ea4207787caab9098041cf5bfe896 +compiler 1fc6b3c4aa9075f3268b81d737341e12280b2778e667fc46c34c95438d648b89 +options 307cf2eafa67562f5c3a6d4555c1fc1ccb9b91f43d0b74d564f5aa0bb73ffd0f +output 16d074eda39e963b6aa931d9aa1cc7b01d94bf3203a9a75c26d194f7026f2232 +local base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 72c9b3d74ed3a2f254cf075a8d282b16f1fcf98058af4913c78df12d94001206 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 false 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 _ 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 true 2177bae1081d12a6f888b5efc89a27616aaf6e5df019f156a0f3d4c2d14bb270 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 id 15f13aeab5531e917cb30154730ad17db4f423c0b92784be7fa1817cb4be2287 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 const c77cf428a6fda9f6d681a1dd832f02118c43fd945fc71542ce78eaadc623b763 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pair 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 if ac3973bb8d73eb8e74df77f2c3354ec7e38002fd77c1d496517a39ee1b83c86f +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 y a8f34a95c4aea2a8fb51e3d1739ccada6d0f5512bf4fb576356ad73672b327e0 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 compose b3c581a1161c578b13f3ece389c4ff38f4936672f0b93a1493d3a6b531624ba0 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 triage 7bb525e2662fcf7fb2191212e9712ac38938392afdd37fbadd85cbe52aa11d0c +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 test 606b5a4981f6012fb36c83ccad2f44f6d8f43c5fe1cb007427aa9ec17e0d6e7e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 matchBool 39d02059a3d96899a9efda052ee980f3f4156dbe7a7c6bea8538e6879b239985 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lAnd 48b77e121652f7372961bcff04a0a1eaeb6ba2b524b5df9e9b236045783e9104 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lOr fda8282b06b0ad4a2989987184cdd2b1e3d81a9355d431c467606f0431e52392 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 matchPair 428a5cfd5801db5ac87c9da8f2ddbfb4ce8b7a3302b25d3f2d216a02b40f0055 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 fst 9f192b52a813c2b0e8d006cb79b5c33eb24d34cc3b484e205a97b92d9511a1b3 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 snd a73e30ab5e97335a924cae33565a0e3c60a996e70bff14cbe0aa0dc446b1ab08 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 not? db15dc91beabc30fde203138433342f4cd572ec6c5cc2ae652e980584cddc782 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 and? c33b6a9af5317a926077e5bf3f3286c625371e4013bdd4eb2d6cf7842454a798 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 or? 0f3b68f1f0b3317d47b7c79debf603dd15c7cb6ebcebb8d4216ea857d2db1605 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 xor? 6db30391b47dac5523b7d421eff8f6e3ac6b48dfc723ac6558fa8e0b748a6efe +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 equal? 37ab54f7fedf85f36aca55547d5a205ce3d60e2b5ed7eacb9062f2074f1ae222 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 succ bd7dabb51b0cd76bf7f71d04e7005f86a3d403f92dad79692e44748c27156ad2 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 ok 7282979573c85fb3546b74f90290f813024820d09496ecfe74742951f8411b7e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 err 4d810ade64bdfd1e19ad0d4ce80b5914c9648c100ffd5473feeb0989eae2acef +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 matchResult 45a2d5a23139f75766ff20aca422fce44496846c19d070213415974a714a8aa0 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 resultIsOk 8b83a2c9da6fad893806e50b8588a553ba00c27d1c85c32a713f95964cbe2297 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 resultIsErr 6bfaf9914afda8da4fe5b4e413351cc3ecfae6255231c36d9e92f49eb141147a +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nothing 6f93378feaa8bf5ab7cefc071175a654c871bfd53f165d7d96795fb2b38483f1 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 just 6740c23886cedc8d876db8c2f3a4e8c2e647bc4b0806552f9b47c1fb2fa5d4e4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 matchMaybe 7b4056a7fd1adf758df99b092f3266b0ccc74f8e1e216f6c4b83b40c10ccd778 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 maybe 93d9826cbc8dfedce6b30320fec22da36e8f436e43c4f2c253fd78ba9d944e41 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 maybeMap 9d2dad5a0f25e8d27d5bc05cc96a358bd2a2b4505722deb850a1d7c7d48564b6 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 maybeBind 5546b1e30e9f8a87efe3f74ddfb68743dacc838ef711e109b03e0f2e6a8c9380 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 maybeOr 3546d328a3e631ebcaf9e823202f849e0af93d26428fd5391fbf23cb8caf9089 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 maybe? 484ed040ccea0331c69910d97b20f793cdf453a107d8ab1dc22b1d00c04b66ee +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lazyBool f03f2296c0d15554284027fb36f54a8adfe3788e20adb5458ae1d7d50d8a4589 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lazyList fa927d04fadb9d3ebfba3e22abd3e65c1eef12f4da1d58179f1adff4a1d7b0b4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lazyMaybe 23c040def207ddf36fae718ca09ab8204cd2d2d4945bf37518cdd99bcb018165 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lazyResult 0d3b6e25ac5c3159d7544b1099b372ad1719d2814e467328cd0f029504be2c88 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 ifLazy 2ef96fcef0cf7575e04d3a73b30898dbd6fe38fca1f39576930d8a16274c6a84 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 andLazy? 308e4f0835b9c1d699c448e713100d11c05ff99c427e9d554ad6eef8dc0a443b +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pred_ 69696da7866e27e9ea092d42b31db98a024c11ec1488f8eabf35a37a7cc40ca8 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 isZero_? 6f3a25e2cefc6b1218b350ea92d5e033ec24f06b4e5f654896c90ac37bc539c9 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lte_? 82389ff72b27c17027b0ef6519c9970c57ee5763fdbbde325405d47f8068baaa +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 gte_? 77afc6d802de693c242fef43a9926352fb882ab975f42e8a26a1935bfc0536fe +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lt_? 6c0aee396c93e987e34f1e5a3966d2ca35422adbb693fa847614f6aa8f1daa06 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 gt_? 14f7c71e956bbab7584612f9aed89406eb20980975f7ea1505dcdbacbcffeaf7 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 even? c60df37fd86c75908a9a7e329ddc6ff741265bd07e13c3d54002a38dac19df6d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 odd? f7f2544607d68e50f6e099a81690fc95bcb854300ce3bfddd29e9d26a9934cbf +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 mapResult 950f0295e5f53e102fa8ef622fc2809b95dc267934f478df667e69371fa7495d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 bindResult 338e7f3b38b16ea2f3ad72e827ccdc82f60e7c36e81faa033989d8fdd85c3682 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 resultOr 52adbf3087fbd9a7221668c46aa4eb71758f6efaeffe28ad68f74dedcc71e232 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 resultMapErr e322b79075674d240a3a71c418f05b7d2bd0b137ac7cd6df5d0888f3ef3d542b +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 matchList f49dbc9358c9105915fe1963efba8f5b9e8c1c55d6be342908a5941cc3b0381b +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 emptyList? 1535dec8df207e8884288469857d96d658b6f31ae36723de6297cd73aab9cfb5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 append 4aaeb4bd6b2a7af21f69c8087cbec2c855447639eb16144f66d78eb607853764 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lExist? 5dca0f201303ecd7e0ec3001e25c2c7666c23b3b4f735b7b2c1cc6e987c76027 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 map 46ce960d8a801592f8570a447dd6a1ceef516578ac1cc0917ac4e814cbfcb43c +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 filter 71b4844ceb59105d349d86448d459190cf4c5fbbe15b165e32bdadc748fb645d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 foldl c08a52db2208eb531c20fa3fbbf5dec2f30b532916a3d18b0504248060deed8e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 foldr 9743fc961b25e342e65ab1ba4c289dcd8c6281b9520331f58f7d8e2489e011f3 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 reverse a6348171c263ae16cd5615cd9451fa5a7b01203aad90ced325bbf12f2d72654e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 snoc fdda39e3fccc1db724c7d4fb4d8072b19a6d8d07909d4be3a15fbd0102214d6d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 count 98bbca2a58359f5cecf7625b82378831b47b811e0327b716708e5e75150e39a0 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 all? 288bba9e1f3df76b3e0fc4149a173087c3b87f865ab5f54c1fee4f4a4f7e8fe8 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 any? 8672355738470f2ba6d686b631c23b2190ad27252dfe6875945e7599b75dfd06 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 intersect 2e3c5d551e2692ee79d9ac526e74dcba404fe485584484748275ebe7110a0476 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nth 1595d67fc59f364252849c0ab9912afb1df1920d368eec16d73c80ccf684a2d2 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 headMaybe f361620ac2ef0c1b51d3937b13936ada3f13290fefdc7afea94303e351ea5c11 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lastMaybe 17c97ee471c216e1e423436fb6955da76f0cc41d8d8626d16262e0da5b894bea +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nthMaybe ed9ebc30b3b122d9bdea5695d829cbd8cb396e97be33f655fb545ec47ee69f2d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 take 5e110471e71391b7f27f12ad9f5d283b90f565fd585b28c83e90172323a50133 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 drop bd7e7a80a46d81a056dcf8eb0022a01aaf9f1ed4e8c2db5f46c1d9ea16e3cb6a +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 splitAt 1d818dd82c0cb76b02e7d2cc95897e0c1b243720b9b17e7807f6916c7727c332 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 concatMap eb2ecbe561ce97f121b0ea61435ad693b63e060f0416f2cd4d220110cd091c99 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 find 4dfa5df842fe7e24cb189035d0f7d84ed4068f4bf08d33647acf2b53c5bb28f6 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 partition b9aa4b6be8a35aab61d81a2ac09c00b4d1f03fe85902830f414456989f2c4201 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 strAppend 4aaeb4bd6b2a7af21f69c8087cbec2c855447639eb16144f66d78eb607853764 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 strEq? 37ab54f7fedf85f36aca55547d5a205ce3d60e2b5ed7eacb9062f2074f1ae222 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 strEmpty? 1535dec8df207e8884288469857d96d658b6f31ae36723de6297cd73aab9cfb5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 startsWith? a616c23161cbd9bbe910f758288dfe9a331a75e046e4653eb139c97672ba98e5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 endsWith? 98267d8c430fe11b6031326c0326f068cd856e77f1080da6c0f676b09c304a18 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 contains? feb10084a609a89081149b1cf0953fb182fc5ba2d8e6de4caf572967508bb59d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 takeWhile d52c11abecd8fc790dcefa2ff5d00a4afb3e1d5020c97fc8679d55abb0146ec4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 dropWhile 991ecd1c1b09fe2f38fe4eb995123a1ef925b7ee03d4e32170173291dbb24fea +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 spaceByte? dc0f9d17a5e4700b52bcfbd2aed5ceb47cb462edf073e5ba66ebe964620154c1 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 tabByte? 335ce1412ddfdebfd1ebe1958378e2b69a9d97c9b0e0c3f2359ee2ec6456ab9d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 trimByte? f19a03a687909f23c09cb7a4777919b323883824e12235998ba364cef12fa451 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 trim db7381597546ab6371250911fa4cb4728155b715406a1ac5d14bf7bea4a3ceed +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 intercalate 357f1b8456713c61e67bc5c9ec3a136260277e45ee47e701180acb2d1b4e8d45 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 joinSuffix b5a9aeba9cb087c95a870af168b33b49d53dc6ec141ba4320e473c6749d639b4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 splitOnByte 80207570f303fb4eb417dedbc8a9ec35f204e54c8db55fd1607f6aac9229f1c5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lines cff127cb6b896ab95a194320a653c68f5525c5916da2bc1e026e6bf1a8a8f714 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 unlines aa6b770d162b36f4f3d623a8457c73bffefc40fa9e97cf6beadb8518b7063ad5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 words 71dfa3a8f772cbe0493d283ea68dbeb9c1fe94748e9625db2dc4c90e44928497 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 unwords dff29d96ee87daf4ab5b5161f64c2011ced05110e9aae1d23b4f2046d542d349 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 zipWith 5ea64420050cfbf4ab8f12eec0a55795c61cce38f07b21d4288cb8c922a66e31 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 contractOk 0b4f25a4f42aae1f84e67f87f1f81c590a8d6786051abddabc44c86994cbf095 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 contractErr c79fdbc60c4b88fd92d3869d1ee689305114caec0352587f9fda894e6214fbe4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 defaultKernel a58461a13d57ccf706aef4def6b9b9acf6354dc7d73bf089cf85fcfafc789614 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 kernel a58461a13d57ccf706aef4def6b9b9acf6354dc7d73bf089cf85fcfafc789614 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 skipKernel 010b0a70dd58d680b697cc9bb75bae5a972c091835ffe75703cc28a30fa2a2af +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 withContract a341a33a19cef1c81cd5f965c30a385491acda415c1abaaf9339b104b3bb7f06 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 check deaafa372b61bb250dbf3cdaa9aacb06ddab9a5c93adfde9a8dad78471c6cbc6 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 checkContract b986eecc4c4cc286b1e3b6b0e189516d40a3ce8b47da2a93947b410f8bb9dd46 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 anyC 7f33bbba98e0295be7461142fb9fd291cd8b9b72f57e996405d140c9d77ab0c4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 neverC 790a1946c80298db361a24c0da9bf69fbdb8e916fab1fc6b1bcb2823c9aa70e5 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 guardC 2ce3272f8ec30a690fa16f5807e87c25eaeb9c18c91092907432455d46311ec4 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 isNat? 1fe22bb91012bc34b90e1ad1f0e0136e018a03d1005dad5705c6b3dae603d0ca +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nat? dbeac1bf02bd15bd9dc6a332a3575b92d117e6558091c6afa8c84bc0ef28fcb6 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pred 3b7376818b6b24820f0d878205e7c075c4b16ce6dfd2fa6dcd37e21b4c65eefb +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 add 7dc28d617a933c820b4ba5b47b551adc70c3079c9fb41381c5aa92b99229caa7 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 sub 770fa156de3739f6bb514c78370f09373e07e85e6a72b0a941d0bc64953fc93d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 mul ef5575aa5eab2529848a3d08c39873c45899a27d1f571316b517a43241160136 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pow b35ba74273ced78b0e33eaca504cfd13c5129bdab7b67f2e9a448df90e9e8c47 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 min 430adf737692e2034f740f4a3819a99a9dff645b66893cd617c8dbbe328f7b34 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 max a6017e99be522cf5c71f3b9d27c78e5054ffe3c867941a158a677a873a1de1e0 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nonZero? dc66d7b5be577c5cdff885ff15d2a7071b73a04a5fbf047c10e65356f2b6ae7f +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 div 2c8de7aee418407dc36f2f4f3507ef6367d5911e6f27e21f010c65fd2013a88e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 mod 85ea24730677944cf9c22b1d33f577728ee7b4afc8a6ffd3aeaa3df964ed5b26 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 bool? 6046dd15a954ac850d38a153a529a1217f201561f2298af0c438c9c3555c1f4d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 isZero? 40320097d7755710028787b09278465d5532c658f5327c47d517e99bb5605e61 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lte? 5811ca02f6d0f1a8bce339b6d3a3f4947b07a8188234eff67f065fea3f83e608 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 gte? 45eec99efd964cf9d81b8869d077be6244c75456549265e2450f75ef02d5015f +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 lt? 991ca968ecff034deaf7de5942ac3eb86668319dfe511700d99da6cfa4b611ad +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 gt? 5d9294b9deab3879c0c0fe3d8e7e7cf1dfc0573608ff0d4a8f15a3a15f7fa54f +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 andC bc17a5d83e1f62ad113d67ffd3035a369c9a6520f2425cf37ae9a2a06377dfd7 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 orC 14eb5ba727dc002757e1279cf87847a6707c9c9523aa5c9cbbd224d2d54bd7a3 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 notC ab14f03adf338e20380c01e8776b047be4a5f529361341507d3bb7b4c84ccbf3 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 mapC 1e6a1f33603e76663e5d7bd12202084ba5c89a468793e1d797581dde82d8b4d3 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 bindC 20a4ee801dfdfbfb6afbc6c83e3a912d395c94e7b78cac28f85ef35a21ee3405 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 listOf ea621fbba2935d086bdcc704ed76313a8e7a7be3fc4e920a16d3d2d24f204a2d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 length 51ca7d600849bdbdd30ea24b8485241704687287208dbba03516714b3dfa4862 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 strLength 51ca7d600849bdbdd30ea24b8485241704687287208dbba03516714b3dfa4862 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 sum 5b1da31a67d25afdf48e2e9af3b3c2788e05b06cbd6fd06346df5403cc5d2668 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 product 1d8c56c2e56f092e99cd70684940f126dc8eefeb79bc70f1bb92b3805653a2a2 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 nonEmptyListOf 858f1f69d8e3790121ec1a8a772509715cff4928d9da99ea49363196da73b9ff +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 head 1cab8d9f6602b4603da7dd1bb25acb679a9da4f20a85dfd8323fb1033068ec63 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 tail fb011a9d6753c3581137965ac8a8285411286d4edff479289b0ed74e02b265e9 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 last 97bd36bfe86feb3bb942c97ec05ba7d3b596dc6c47e82cafdf67149fc30ec71e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pairOf 94fd64911b2f13a1871c98d33a1582663dd3f4023ae158390e592a63cde6412a +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 divMod 78272d6ed9a7f1392f8e3e09494446e5406ef7fef1e87716f5c1cc10c3c5833e +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 fnContract b5cce804b228e049db43b287b9555e730bc24523727fd2e6987462e30dee7c64 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 fn2 188932da4e16a93fb78f3d3645b3edc783142597b7fa3dacaddc1f0a6552767c +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pureE c77cf428a6fda9f6d681a1dd832f02118c43fd945fc71542ce78eaadc623b763 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 bindE 267659648ab5c102117d1ad32a1ccc4cfe34be963bd36ce470b839673721465d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 exceptE a40ba9b07b2a220da92678a745332db403f3f85a0f8bbfb38abf261c7bef0d49 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 pureM c77cf428a6fda9f6d681a1dd832f02118c43fd945fc71542ce78eaadc623b763 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 bindM 267659648ab5c102117d1ad32a1ccc4cfe34be963bd36ce470b839673721465d +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 checkM 685b7911b11857d314cbb840cf7eaaf278414a4252782b4542d83463cb6fe982 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 liftM 5a6509acc0b3de69063e9eac30282e318756f3d654d1912f5743d0cd08609466 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 runM 50b8f2be7561316be56bf29f6c6a6ac219a1f2ae4a12ee8982fb643119876100 +pin base 59a42e855215b01b45441e02bf6cfc7b47d2ba3e064e0583eff3d2498b6a3d88 handleM 606a55945b35ca3359f7f1cd0573f47fb6032fb2e88f98119d94584096761c1d diff --git a/test/native_library_migration.py b/test/native_library_migration.py @@ -20,7 +20,7 @@ from generation_backend import BACKENDS, DEFAULT_BACKEND REPO = Path(__file__).resolve().parent.parent LIBRARIES = { 'socket': 'lib/socket.tri', 'binary': 'lib/binary.tri', - 'parser': 'lib/parser.tri', + 'parser': 'lib/parser.tri', 'patterns': 'lib/patterns.tri', 'intensional': 'lib/intensionalContracts.tri', 'http': 'lib/http.tri', 'arboricx.common': 'lib/arboricx/common.tri', 'arboricx.nodes': 'lib/arboricx/nodes.tri', diff --git a/test/repair_support_fixture.py b/test/repair_support_fixture.py @@ -43,6 +43,20 @@ def select_candidates(directories, replacements): return selected +def relocate_patterns(original, candidates): + """Explicit compiler-to-support move; never widen ordinary rewrite policy.""" + if 'patterns' not in candidates: + raise ValueError('relocation requires rebuilt patterns') + record, payload = candidates['patterns'] + if (record['legacy'], record['path']) != ('patterns', 'lib/patterns.tri'): + raise ValueError('invalid patterns relocation identity') + rows = [row.split('\t') for row in original if row.startswith('module\t')] + if any(row[2] == 'patterns' or row[3] == 'lib/patterns.tri' for row in rows): + raise ValueError('patterns already belongs to support') + return [*original, '\t'.join(['module', 'patterns', 'patterns', + 'lib/patterns.tri', digest('arboricx.source.v1', payload)])] + + def updated_module_rows(original, candidates): """Keep cohort membership/identity, not rebuilt source fingerprints.""" rows = [row.split('\t') for row in original if row.startswith('module\t')] @@ -98,6 +112,8 @@ def main(): parser.add_argument('tricu', type=Path) parser.add_argument('directory', type=Path, nargs='+') parser.add_argument('--replace', action='append', default=[], metavar='ALIAS') + parser.add_argument('--relocate-patterns', action='store_true', + help='explicitly move rebuilt patterns from compiler to support membership') parser.add_argument('--output-directory', type=Path, required=True, help='new candidate directory; never overwrite published fixtures') parser.add_argument('--verification-memory-mib', type=int, default=8192, @@ -158,7 +174,12 @@ def main(): sources[record['path']] = source imported = json.loads((directory / 'events.json').read_text())[0]['stdout'] identities[alias] = re.search(r'sourceBuildGraph -> ([0-9a-f]{64})', imported)[1] - modules = updated_module_rows(old, candidates) + membership = relocate_patterns(old, candidates) if args.relocate_patterns else old + modules = updated_module_rows(membership, candidates) + if args.relocate_patterns: + from fixture_sources import source_rows + if any(row[2] == 'patterns' for row in source_rows(inputs) if row[0] == 'compiler-library'): + raise ValueError('patterns still belongs to the published compiler fixture') selections = [] evidence = output / 'support-receipts' evidence.mkdir() @@ -198,7 +219,10 @@ def main(): raise ValueError('source changed during publication') if compiler.read_bytes() != compiler_bytes: raise ValueError('compiler fixture changed during publication') - metadata = ['tricu.support-library-fixture.v2', *modules] + metadata = ['tricu.support-library-fixture.v3' if args.relocate_patterns else + 'tricu.support-library-fixture.v2', *modules] + if args.relocate_patterns: + metadata.append('relocated\tcompiler-library\tpatterns\tpatterns\tlib/patterns.tri') for label, domain, payload in [ ('compiler-fixture', 'tricu.compiler-library-fixture.v1', compiler_bytes), ('origin-metadata', 'tricu.support-origin-metadata.v1', (output / 'support-origin.v1').read_bytes()), diff --git a/test/unit.py b/test/unit.py @@ -714,6 +714,23 @@ class FixtureSourceTests(unittest.TestCase): class SupportPublicationTests(unittest.TestCase): + def test_patterns_relocation_is_explicit_and_identity_checked(self): + from repair_support_fixture import relocate_patterns, updated_module_rows + old = ['module\thttp\thttp\tlib/http.tri\told-source'] + record = dict(legacy='patterns', path='lib/patterns.tri') + candidates = {'patterns': (record, b'!export main\nmain = t\n')} + with self.assertRaisesRegex(ValueError, 'membership'): + updated_module_rows(old, candidates) + relocated = relocate_patterns(old, candidates) + self.assertEqual(updated_module_rows(relocated, candidates), relocated) + self.assertEqual(old, ['module\thttp\thttp\tlib/http.tri\told-source']) + with self.assertRaisesRegex(ValueError, 'requires rebuilt'): + relocate_patterns(old, {}) + with self.assertRaisesRegex(ValueError, 'identity'): + relocate_patterns(old, {'patterns': (dict(record, path='other.tri'), b't')}) + with self.assertRaisesRegex(ValueError, 'already belongs'): + relocate_patterns(relocated, candidates) + def test_changed_source_has_a_new_authenticated_fingerprint(self): from repair_support_fixture import updated_module_rows old = ['module\thttp\thttp\tlib/http.tri\told-source',