1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Factor the application of toLeafInfos out.

This commit is contained in:
Rob Rix 2017-05-05 15:48:54 -04:00
parent c3f510f83d
commit f820af4f5a

View File

@ -113,10 +113,10 @@ toTOCSummaries patch = case afterOrBefore patch of
_ -> NotSummarizable
flattenPatch :: Patch DiffInfo -> [Patch DiffInfo]
flattenPatch patch = case patch of
Replace i1 i2 -> zipWith Replace (toLeafInfos i1) (toLeafInfos i2)
Insert info -> Insert <$> toLeafInfos info
Delete info -> Delete <$> toLeafInfos info
flattenPatch patch = case toLeafInfos <$> patch of
Replace i1 i2 -> zipWith Replace i1 i2
Insert info -> Insert <$> info
Delete info -> Delete <$> info
toLeafInfos :: DiffInfo -> [DiffInfo]
toLeafInfos BranchInfo{..} = branches >>= toLeafInfos