1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Add a function to align branch elements into their lines.

This commit is contained in:
Rob Rix 2016-05-20 22:17:39 -04:00
parent 30bfae37aa
commit 24af4c4af5

View File

@ -185,6 +185,10 @@ data BranchElement
= Child String (Join These String {- newlines or asterisks -})
| Margin (Join These String {- newlines or hyphens -})
alignBranchElement :: BranchElement -> [BranchElement]
alignBranchElement (Child key contents) = Child key <$> traverse lines contents
alignBranchElement (Margin contents) = Margin <$> traverse lines contents
toSource :: [BranchElement] -> Source.Source Char
toSource = Source.fromList . concatMap show