git.iko.soy/rowtype-yoga/purescript-yoga-tree
on master help sign in
renamed some params using the Forest type alias instead of it's full expanded type
commite6930590834dfb084c7a6cce591fd6543c52e80c authorDustin Whitney <dustin.whitney@gmail.com> dateTue 19 Jun 2018, 09:44 (8 years ago) parentc242a17
1 file changed+3−3
src/Data/Tree.purs+3−3
src/Data/Tree.purs+3−3
@@ -21,7 +21,7 @@ mkTree = mkCofree
2121drawTree :: Tree String -> String
2222drawTree t = tailRec go {level: 0, drawn: (head t) <> "\n", current: (tail t)}
2323 where
24− go :: { current :: List (Tree String) , drawn :: String , level :: Int } -> Step { current :: List (Tree String) , drawn :: String , level :: Int } String
24+ go :: { current :: Forest String , drawn :: String , level :: Int } -> Step { current :: Forest String , drawn :: String , level :: Int } String
2525 go {level: l, drawn: s, current: Nil} = Done s
2626 go {level: l, drawn: s, current: c:cs } =
2727 let drawn = (power " " l) <> "|----> " <> (head c) <> "\n" in
@@ -39,7 +39,7 @@ scanTree f b n =
3939 let fb = f (head n) b
4040 in fb :< (tailRec go {b: fb, current: (tail n), final: Nil})
4141 where
42− go :: { final :: List (Cofree List b) , current :: List (Cofree List a) , b :: b } -> Step { final :: List (Cofree List b) , current :: List (Cofree List a) , b :: b } (Forest b)
42+ go :: { final :: Forest b , current :: Forest a , b :: b } -> Step { final :: Forest b , current :: Forest a , b :: b } (Forest b)
4343 go {b: b', current: Nil, final: final} = Done final
4444 go {b: b', current: c:cs, final: final} =
4545 let fb' = f (head c) b'
@@ -52,7 +52,7 @@ scanTreeAccum f b n =
5252 let fb = f (head n) b
5353 in fb.value :< (tailRec go {b: fb.accum , current: (tail n), final: Nil})
5454 where
55− go :: { final :: List (Cofree List c) , current :: List (Cofree List a) , b :: b } -> Step { final :: List (Cofree List c) , current :: List (Cofree List a) , b :: b } (Forest c)
55+ go :: { final :: Forest c , current :: Forest a , b :: b } -> Step { final :: Forest c , current :: Forest a , b :: b } (Forest c)
5656 go {b: b', current: Nil, final: final} = Done final
5757 go {b: b', current: c:cs, final: final} =
5858 let fb' = f (head c) b'