e014061b2107cb0d8d1d2366742c8f35640c9a7dd85b80fc78d4afc7813bf0cc.tri (1053B)
1 !import base as B 2 !import io_v2 as IO 3 !import io_v2_storage as Storage 4 !import io_v2_text as Text 5 !import arboricx as Bundle 6 !export main 7 !export run 8 !export runBundle 9 -- Whole-bundle source decoding is explicitly bounded, not a streaming decoder. 10 -- Selecting/executing this program is authority to execute the selected bundle; 11 -- bundle validation alone is not authentication or a computation-resource quota. 12 -- Container remainders are internal directory cursors, not unconsumed input; 13 -- bytes outside declared sections are permitted by the portable reader profile. 14 runBundle path argument = IO.bind (Storage.readBytes path 1048576) (read : case read of 15 ((t t), (bytes, t)) = case Bundle.runArboricx bytes argument of 16 ((t t), (value, _)) = IO.require IO.stdout (writer : IO.require (Text.writeText writer (B.append value "\n")) IO.pure) 17 _ = IO.fail "Could not validate/execute bundle" 18 _ = IO.fail "Could not read bundle file") 19 main = IO.io (runBundle "test/fixtures/id.arboricx" "hi") 20 run path argument = IO.io (runBundle path argument)