consumer_base_bundle_run.tri (2335B)
1 -- Independently packed SCP base programs, shared interpreter and lambdas. 2 !import "source.module" !Local 3 !import "io" !Local 4 !import "prelude" !Local 5 root = "__ROOT__" 6 check = do onOk_ 7 run <- sourceModuleLoadSelected root "scpBase" "runConsumer" 8 mapping <- sourceModuleLoadSelected root "scpBase" "mapProgram" 9 folding <- sourceModuleLoadSelected root "scpBase" "foldProgram" 10 prepending <- sourceModuleLoadSelected root "scpBase" "prependProgram" 11 reversing <- sourceModuleLoadSelected root "scpBase" "reverseProgram" 12 filtering <- sourceModuleLoadSelected root "scpBase" "filterProgram" 13 nonempty <- sourceModuleLoadSelected root "scpBase" "nonemptyProgram" 14 prefixer <- sourceModuleLoadSelected root "scpBase" "stripPrefixProgram" 15 unwrapper <- sourceModuleLoadSelected root "scpBase" "unwrapProgram" 16 pathNamer <- sourceModuleLoadSelected root "scpBase" "pathNameProgram" 17 lambdaReverse <- sourceModuleLoadSelected root "lambdaBase" "listReverse" 18 lambdaFilter <- sourceModuleLoadSelected root "lambdaBase" "listFilter" 19 lambdaPrefix <- sourceModuleLoadSelected root "lambdaBase" "listPrefix" 20 lambdaPath <- sourceModuleLoadSelected root "lambdaBase" "listPathName" 21 compiler <- sourceModuleLoadSelected root "scpCompiler" "compileBaseSource" 22 source <- readFile "lib/consumer/map.scp" 23 pure (ok (foldl and? true [(equal? (snd (resultOr t (compiler source))) mapping) 24 (equal? (resultOr (t t) (run 25 (pair (pair folding prepending) (snd reversing)) [1 2 3])) [3 2 1]) 26 (equal? (resultOr (t t) (run 27 (pair nonempty (snd filtering)) [[] [1] [2 3] []])) 28 (lambdaFilter (x : not? (emptyList? x)) [[] [1] [2 3] []])) 29 (equal? (resultOr (t t) (run 30 (pair (pair folding prepending) (snd reversing)) [1 2 3])) 31 (lambdaReverse [1 2 3])) 32 (equal? (resultOr (t t) (run 33 (pair "/_arboricx/" (snd prefixer)) "/_arboricx/health")) 34 (lambdaPrefix "/_arboricx/" "/_arboricx/health")) 35 (equal? (resultOr (t t) (run 36 (pair (pair (pair "/_arboricx/" (snd prefixer)) unwrapper) 37 (snd pathNamer)) "/_arboricx/health")) 38 (lambdaPath "/_arboricx/" "/_arboricx/health"))]) t) 39 main = io (onResult_ check 40 (problem : putStrLn (append "scp-base-load-fail=" problem)) 41 (pass : putStrLn (matchBool "scp-base-bundle-ok" "scp-base-bundle-DIFFER" pass))) 42 main