-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSimple.hs
More file actions
43 lines (35 loc) · 1.08 KB
/
TestSimple.hs
File metadata and controls
43 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module Main (
main
) where
import Zipper
main :: IO()
main = do
tt <- modifyFocusTreeIO testFocusTree
t <- return (fst tt)
printTree t
testTree :: Tree Double
testTree = Node 20
(Node 34
(Node 9
(Node 8923654
(Node 6
(Node 4
(Node 98876223456.3463
Leaf Leaf)
Leaf)
Leaf)
Leaf)
Leaf)
Leaf)
(Node 54
Leaf Leaf)
testFocusTree :: FocusTree Double
testFocusTree = (testTree, [L,L,L,L,L,L])
modifyFocusTreeIO :: Fractional a => FocusTree a -> IO (FocusTree a)
modifyFocusTreeIO ft = return (modifyFocusTree' 10000000 ft)
modifyFocusTree' :: Fractional a => Int -> FocusTree a -> FocusTree a
modifyFocusTree' 0 ft = ft
modifyFocusTree' n ft = modifyFocusTree'' (n-1) (modifyFocus ft div3Node)
modifyFocusTree'' :: Fractional a => Int -> FocusTree a -> FocusTree a
modifyFocusTree'' 0 ft = ft
modifyFocusTree'' n ft = modifyFocusTree' (n-1) (modifyFocus ft doubleNode)