1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

🔥 unionRanges.

This commit is contained in:
Rob Rix 2017-01-20 14:36:10 -05:00
parent 427afdf61c
commit f8c4b00411

View File

@ -60,10 +60,6 @@ intersectionRange range1 range2 = Range (max (start range1) (start range2)) (min
unionRange :: Range -> Range -> Range
unionRange (Range start1 end1) (Range start2 end2) = Range (min start1 start2) (max end1 end2)
-- | Return a range that contains all the ranges in a Foldable, or Range 0 0 if its empty.
unionRanges :: Foldable f => f Range -> Range
unionRanges = unionRangesFrom (Range 0 0)
-- | Return Just the concatenation of any elements in a Foldable, or Nothing if it is empty.
maybeConcat :: (Foldable f, Semigroup a) => f a -> Maybe a
maybeConcat = getOption . foldMap (Option . Just)