Mercurial > hg > Members > toma > Jungle-haskell
comparison test.hs @ 7:644e1345ee83
add debugging function
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 13 Jan 2014 11:43:41 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:8bba94ec8c63 | 7:644e1345ee83 |
---|---|
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 -} |