tricu

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

consumer_tree_input.tri (1113B)


      1 -- Existing tree-term codec is the only argument encoding authority.
      2 !import "prelude" !Local
      3 !import "io" !Local
      4 !import "source.object" O
      5 !import "source.module" M
      6 root = "__ROOT__"
      7 setup = do onOk_
      8   manifest <- M.sourceModulePublishNames root
      9     [(pair "identity" (value : value))
     10      (pair "arguments" (a b c : matchBool "ordered" "BAD"
     11        (foldl and? true [(equal? a (pair 7 (t t)))
     12          (equal? b "middle") (equal? c (pair 7 (t t)))])))] ["identity" "arguments"]
     13   input <- O.sourceObjectPutTree root (pair 7 (t t))
     14   wrongDomain <- O.sourceObjectStore root "not-a-tree" (O.sourceObjectEncode (pair 7 (t t)))
     15   _ <- writeFile "__ROOT__/argument.tree" (O.sourceObjectEncode (pair 7 (t t)))
     16   _ <- writeFile "__ROOT__/empty.tree" (O.sourceObjectEncode t)
     17   _ <- writeFile "__ROOT__/shifted.tree" (O.sourceObjectEncode (pair 0 0))
     18   _ <- writeFile "__ROOT__/malformed.tree" [3]
     19   _ <- writeFile "__ROOT__/trailing.tree" [0 0]
     20   thenIO (putStrLn (append "manifest=" manifest))
     21     (thenIO (putStrLn (append "input=" input))
     22       (putStrLn (append "wrong-domain=" wrongDomain)))
     23 main = io setup
     24 main