mirror of
https://github.com/rowtype-yoga/purescript-yoga-tree.git
synced 2024-09-11 16:35:29 +03:00
renamed some params using the Forest type alias instead of it's full expanded type
This commit is contained in:
parent
c242a176e4
commit
e693059083
@ -21,7 +21,7 @@ mkTree = mkCofree
|
||||
drawTree :: Tree String -> String
|
||||
drawTree t = tailRec go {level: 0, drawn: (head t) <> "\n", current: (tail t)}
|
||||
where
|
||||
go :: { current :: List (Tree String) , drawn :: String , level :: Int } -> Step { current :: List (Tree String) , drawn :: String , level :: Int } String
|
||||
go :: { current :: Forest String , drawn :: String , level :: Int } -> Step { current :: Forest String , drawn :: String , level :: Int } String
|
||||
go {level: l, drawn: s, current: Nil} = Done s
|
||||
go {level: l, drawn: s, current: c:cs } =
|
||||
let drawn = (power " " l) <> "|----> " <> (head c) <> "\n" in
|
||||
@ -39,7 +39,7 @@ scanTree f b n =
|
||||
let fb = f (head n) b
|
||||
in fb :< (tailRec go {b: fb, current: (tail n), final: Nil})
|
||||
where
|
||||
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)
|
||||
go :: { final :: Forest b , current :: Forest a , b :: b } -> Step { final :: Forest b , current :: Forest a , b :: b } (Forest b)
|
||||
go {b: b', current: Nil, final: final} = Done final
|
||||
go {b: b', current: c:cs, final: final} =
|
||||
let fb' = f (head c) b'
|
||||
@ -52,7 +52,7 @@ scanTreeAccum f b n =
|
||||
let fb = f (head n) b
|
||||
in fb.value :< (tailRec go {b: fb.accum , current: (tail n), final: Nil})
|
||||
where
|
||||
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)
|
||||
go :: { final :: Forest c , current :: Forest a , b :: b } -> Step { final :: Forest c , current :: Forest a , b :: b } (Forest c)
|
||||
go {b: b', current: Nil, final: final} = Done final
|
||||
go {b: b', current: c:cs, final: final} =
|
||||
let fb' = f (head c) b'
|
||||
|
Loading…
Reference in New Issue
Block a user