Fix folding
This commit is contained in:
parent
64aa07e04c
commit
dc9353a374
1 changed files with 4 additions and 1 deletions
|
|
@ -27,7 +27,10 @@ flatten ln
|
||||||
| lineFolded ln = V.singleton ([], ln)
|
| lineFolded ln = V.singleton ([], ln)
|
||||||
| otherwise =
|
| otherwise =
|
||||||
V.cons ([], ln) $
|
V.cons ([], ln) $
|
||||||
V.imap (\i (is, n) -> (i : is, n)) $ V.concatMap flatten $ lineChildren ln
|
V.concat $ V.toList $ V.imap flattenChild $ lineChildren ln
|
||||||
|
where
|
||||||
|
flattenChild :: Int -> LineNode -> V.Vector (Path, LineNode)
|
||||||
|
flattenChild i c = V.map (\(is, n) -> (i : is, n)) $ flatten c
|
||||||
|
|
||||||
modify :: (LineNode -> LineNode) -> Path -> LineNode -> LineNode
|
modify :: (LineNode -> LineNode) -> Path -> LineNode -> LineNode
|
||||||
modify f [] ln = f ln
|
modify f [] ln = f ln
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue