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

Document spanThese.

This commit is contained in:
Rob Rix 2016-04-08 12:06:19 -04:00
parent dcd9431987
commit 65157c54f2

View File

@ -153,6 +153,10 @@ group2 ranges children | Just (headRanges, tailRanges) <- unconsThese ranges
| ([]:rest) <- children = group2 ranges rest
| otherwise = ([] <$ ranges, children, fmap (flip (,) []) <$> sequenceL ranges)
-- | Partitions and splits a list of children into a triple consisting of:
-- | - elements which matched; if an element matches only partially this field will contain only the matching side
-- | - the opposite sides of elements which matched only on the other side
-- | - elements which do not intersect.
spanThese :: (Join These a -> Join These Bool) -> [[Join These a]] -> ([[Join These a]], [[Join These a]], [[Join These a]])
spanThese pred children | (child:rest) <- children
, not (null child)