21 lines
565 B
Plaintext
21 lines
565 B
Plaintext
!import "../../lib/base.tri" !Local
|
|
!import "../../lib/list.tri" !Local
|
|
!import "../../lib/io.tri" !Local
|
|
|
|
-- Write a file, then read it back.
|
|
-- thenIO discards the writeFile Result and continues.
|
|
-- Run with --unsafe-io (needs both read and write permissions).
|
|
|
|
writeThenRead = (path text :
|
|
thenIO
|
|
(writeFile path text)
|
|
(readFile path))
|
|
|
|
main = io <|
|
|
(bind (writeThenRead "/tmp/tricu-demo.txt" "hello from tricu")
|
|
(result :
|
|
matchResult
|
|
(err rest : putStrLn "error")
|
|
(contents rest : putStrLn contents)
|
|
result))
|