writeThenRead.tri (498B)
1 !import prelude * 2 !import io * 3 !export * 4 5 -- Write a file, then read it back. 6 -- thenIO discards the writeFile Result and continues. 7 -- Run with --unsafe-io (needs both read and write permissions). 8 9 writeThenRead = (path text : 10 thenIO 11 (writeFile path text) 12 (readFile path)) 13 14 main = io <| 15 (bind (writeThenRead "/tmp/tricu-demo.txt" "hello from tricu") 16 (result : 17 matchResult 18 (err rest : putStrLn "error") 19 (contents rest : putStrLn contents) 20 result))