060a440835999d443ef767ea5d4e9efe616a7186e1bb04947d6f9f80a21b0a4b.tri (642B)
1 !import base as B 2 !import io_v2 as IO 3 !import io_v2_text as Text 4 !export main 5 !export run 6 !export shout 7 safeRead path = IO.bind (IO.scope (owner : do IO.onOk 8 reader <- IO.openReader owner path 9 Text.readText reader 1048576)) (reply : case reply of 10 ((t t), (text, t)) = IO.pure text 11 (t, (_, t)) = IO.pure "missing" 12 _ = IO.fail "Invalid file reply") 13 shout path = IO.bind (safeRead path) (text : IO.pure (B.append text "!!!")) 14 main = IO.io (IO.bind (shout "demos/interactionTrees/greet.tri") (text : 15 IO.require IO.stdout (writer : IO.require (Text.writeText writer (B.append text "\n")) IO.pure))) 16 run path = IO.io (shout path)