comparison test/test.hs @ 8:f03876c8236a

add ParRead
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 14 Jan 2014 18:09:51 +0900
parents test.hs@644e1345ee83
children 947c5cfa4149
comparison
equal deleted inserted replaced
7:644e1345ee83 8:f03876c8236a
1 {-# LANGUAGE OverloadedStrings #-}
2
3 import Jungle
4 import Data.Maybe
5 import qualified Data.ByteString.Lazy.Char8 as B
6
7 jungle = createJungle
8
9 tree = do
10 a <- createTree jungle "test"
11 let
12 t = fromJust $ getTreeByName a "test"
13 node <- getRootNode t
14 return (add node)
15
16 addc path pos node = addNewChildAt node path pos
17
18 addchild =
19 (addc [3] 2) . (addc [] 3) . (addc [1,1] 2) . (addc [1,1] 1). (addc [2] 2) . (addc [1] 2) .
20 (addc [2] 1) . (addc [] 2). (addc [1] 1) . (addc [] 1)
21
22 adda path key value node = putAttribute node path key value
23
24 addattr =
25 (adda [1,1] "key" "value") . (adda [1,1] "test" "test2") .
26 (adda [] "root" "node") . (adda [1] "tes" "abc") .
27 (adda [3,2] "test" "3-2") . (adda [2,2] "test" "2-2")
28
29 add = addattr . addchild
30
31 {-
32 ghci> :l test.hs
33 ghci> y <- tree
34 ghci> putStrLn $ printAttributes y
35 ghci> putStrLn $ drawNode y
36 -}