From dc9353a374c0fdfa50d9cba816f702aa479a3d34 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 1 Mar 2020 00:22:25 +0000 Subject: [PATCH] Fix folding --- src/Profold/LineNode.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Profold/LineNode.hs b/src/Profold/LineNode.hs index 9473eb2..7a25aea 100644 --- a/src/Profold/LineNode.hs +++ b/src/Profold/LineNode.hs @@ -27,7 +27,10 @@ flatten ln | lineFolded ln = V.singleton ([], ln) | otherwise = 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 f [] ln = f ln