1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Compute the aligned children from a list of branch elements.

This commit is contained in:
Rob Rix 2016-05-20 23:51:24 -04:00
parent e4dd1e7cd8
commit f720901dbc

View File

@ -204,6 +204,11 @@ toSourcesAndRanges elements = (sources, Source.actualLineRanges <$> totalRanges
where sources = toSources elements
totalRanges = totalRange <$> sources
toAlignedChildren :: [BranchElement] -> [(String, [Join These String])]
toAlignedChildren elements = elements >>= go
where go child@(Child key contents) = [ (key, branchElementContents <$> alignBranchElement child) ]
go (Margin _) = []
instance Arbitrary BranchElement where
arbitrary = oneof [ key >>= \ key -> Child key <$> joinTheseOf (contents key)
, Margin <$> joinTheseOf margin ]