Cleanup
This commit is contained in:
@@ -12,6 +12,8 @@ module Dodge.Tree.Compose
|
||||
, overwriteLabel
|
||||
, composeTree
|
||||
, composeTree'
|
||||
, shiftChildren
|
||||
, attachTree
|
||||
, composeTreeRand
|
||||
-- , compTree
|
||||
) where
|
||||
@@ -124,6 +126,11 @@ newf t = safeUpdateSingleNode (isJust . upf . snd) ( (root . _2 %~ g) . (root .
|
||||
upf = t ^?! root . _1
|
||||
g x = fromMaybe x (upf x)
|
||||
|
||||
attachTree :: (a -> Maybe a) -> Tree a -> Tree ([Tree a],a) -> Tree ([Tree a],a)
|
||||
attachTree upf t = safeUpdateSingleNode (isJust . upf . snd) ( (root . _2 %~ g) . (root . _1 .:~ t ) )
|
||||
where
|
||||
g x = fromMaybe x (upf x)
|
||||
|
||||
shiftChildren :: Tree ([Tree a],a) -> Tree a
|
||||
shiftChildren (Node (ts,x) ts') = Node x (ts ++ map shiftChildren ts')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user