1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 12:21:57 +03:00

Fold adjoin2Lines over leaves.

This commit is contained in:
Rob Rix 2015-12-10 16:11:13 -05:00
parent db23e4792d
commit 57a3062446

View File

@ -127,7 +127,7 @@ diffToRows (Pure (Replace a b)) _ before after = (replacedRows, (leftRange, righ
termToLines :: Term a Info -> String -> ([Line], Range) termToLines :: Term a Info -> String -> ([Line], Range)
termToLines (Info range _ categories :< syntax) source = (rows syntax, range) termToLines (Info range _ categories :< syntax) source = (rows syntax, range)
where where
rows (Leaf _) = Line . (:[]) <$> elements rows (Leaf _) = reverse $ foldl adjoin2Lines [] $ Line . (:[]) <$> elements
rows (Indexed i) = rewrapLineContentsInUl <$> childLines i rows (Indexed i) = rewrapLineContentsInUl <$> childLines i
rewrapLineContentsInUl (Line elements) = Line [ Ul (classify categories) elements ] rewrapLineContentsInUl (Line elements) = Line [ Ul (classify categories) elements ]