mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Simplify maybeUnionRanges.
This commit is contained in:
parent
aea8e3e200
commit
6b17c3c1ff
@ -73,8 +73,8 @@ unionRangesFrom :: (Functor f, Foldable f) => Range -> f Range -> Range
|
||||
unionRangesFrom range ranges = option range id . foldl mappend mempty $ Option . Just <$> ranges
|
||||
|
||||
-- | Return Just the union of all the ranges in a Foldable, or else Nothing.
|
||||
maybeUnionRanges :: (Functor f, Foldable f) => f Range -> Maybe Range
|
||||
maybeUnionRanges ranges = getOption $ foldl mappend mempty $ Option . Just <$> ranges
|
||||
maybeUnionRanges :: Foldable f => f Range -> Maybe Range
|
||||
maybeUnionRanges ranges = getOption $ foldMap (Option . Just) ranges
|
||||
|
||||
instance Monoid (Option Range) where
|
||||
mempty = Option Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user