1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Implement catThese in terms of Union.

This commit is contained in:
Rob Rix 2016-04-14 12:05:52 -04:00
parent c547f4e13d
commit 17728c5f6d

View File

@ -161,9 +161,7 @@ spanAndSplitFirstLines pred = foldr go ([], [])
| otherwise = (intersecting, nonintersecting)
catThese :: [Join These a] -> Join These [a]
catThese [ a ] = pure <$> a
catThese (a:as) = fromMaybe (Join (These [] [])) $ (:) <$> a `applyThese` catThese as
catThese [] = Join (These [] [])
catThese as = maybe (Join (These [] [])) Join $ getUnion $ mconcat $ Union . Just . runJoin . fmap pure <$> as
-- | Partitions and splits a list of children into a tuple consisting of:
-- | - elements which matched; if an element matches only partially this field will contain only the matching side