Cleanup
This commit is contained in:
@@ -45,7 +45,7 @@ shiftChildren :: Tree ([Tree a], a) -> Tree a
|
||||
shiftChildren (Node (ts, x) ts') = Node x (ts ++ map shiftChildren ts')
|
||||
|
||||
composeTree :: MetaTree a b -> Tree a
|
||||
composeTree mt = attachList' (composeNode $ _mtTree mt) (_mtBranches mt)
|
||||
composeTree mt = attachList (composeNode $ _mtTree mt) (_mtBranches mt)
|
||||
|
||||
mtTopLabels :: MetaTree a b -> Tree b
|
||||
mtTopLabels (MTree lab _ bs) = Node lab (map (mtTopLabels . _mbTree) bs)
|
||||
@@ -67,7 +67,6 @@ decomposeSelfTree st = fmap fst (_unST st) : concatMap (f . snd) (_unST st)
|
||||
combineTree :: (a -> b) -> MetaTree a b -> SelfTree b
|
||||
combineTree f mt = case _mtTree mt of
|
||||
NodeTree t -> ST (Node (_mtLabel mt, Left $ fmap f t) (_unST . combineTree f . _mbTree <$> _mtBranches mt))
|
||||
--NodeTree t -> ST (Node (Left $ fmap f t) _)
|
||||
NodeMTree mt' ->
|
||||
ST
|
||||
( Node (_mtLabel mt, Right $ combineTree f mt') $
|
||||
@@ -78,8 +77,8 @@ composeNode :: MetaNode a b -> Tree a
|
||||
composeNode (NodeTree t) = t
|
||||
composeNode (NodeMTree mt) = composeTree mt
|
||||
|
||||
attachList' :: Tree a -> [MetaBranch a b] -> Tree a
|
||||
attachList' t = shiftChildren . foldr attachBranch (fmap ([],) t)
|
||||
attachList :: Tree a -> [MetaBranch a b] -> Tree a
|
||||
attachList t = shiftChildren . foldr attachBranch (fmap ([],) t)
|
||||
|
||||
attachBranch :: MetaBranch a b -> Tree ([Tree a], a) -> Tree ([Tree a], a)
|
||||
attachBranch mb =
|
||||
|
||||
Reference in New Issue
Block a user