Update demos and adds <|
This commit is contained in:
20
demos/interactionTrees/writeThenRead.tri
Normal file
20
demos/interactionTrees/writeThenRead.tri
Normal file
@@ -0,0 +1,20 @@
|
||||
!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))
|
||||
Reference in New Issue
Block a user