1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Define pairRangesWithLine over a Monoid instance to be total.

This commit is contained in:
Rob Rix 2016-04-01 10:56:44 -04:00
parent 8104f174ab
commit 1b1e88b4fd

View File

@ -164,10 +164,8 @@ advanceRight (Join (These as (_:bs))) = Join (These as bs)
advanceRight (Join (That (_:bs))) = Join (That bs)
advanceRight other = other
pairRangesWithLine :: Join These a -> Join These b -> Join These (a, b)
pairRangesWithLine headRanges childLine = case (,) <$> headRanges `applyThese` childLine of
Just v -> v
Nothing -> error "oh god no"
pairRangesWithLine :: Monoid b => Join These a -> Join These b -> Join These (a, b)
pairRangesWithLine headRanges childLine = fromMaybe (flip (,) mempty <$> headRanges) $ (,) <$> headRanges `applyThese` childLine
{-