tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

32496972f1c1b6b06eb6fb58b83e054d692ea9e5e4b601947c20c72c92a0751b.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))