1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Revert "Move safeRange into the Range module."

This reverts commit 781f940cad93db3954ddb9f2ddd9de23c432a68f.
This commit is contained in:
Rob Rix 2016-03-03 10:42:03 -05:00
parent ca432139f8
commit 9981e98a77
2 changed files with 4 additions and 4 deletions

View File

@ -109,6 +109,10 @@ splitAnnotatedByLines sources ranges categories syntax = case syntax of
makeRanges :: Both Int -> Both Int -> Both Range
makeRanges a b = runBothWith safeRange <$> sequenceA (both a b)
-- | Constructs a Range such that its end is clamped to its start.
safeRange :: Int -> Int -> Range
safeRange start end = Range start (max start end)
-- | Produces the starting indices of a diff.
diffRanges :: Diff leaf Info -> Both (Maybe Range)
diffRanges (Free (Annotated infos _)) = Just . characterRange <$> infos

View File

@ -15,10 +15,6 @@ data Range = Range { start :: !Int, end :: !Int }
rangeAt :: Int -> Range
rangeAt a = Range a a
-- | Constructs a Range such that its end is clamped to its start.
safeRange :: Int -> Int -> Range
safeRange start end = Range start (max start end)
-- | Return the length of the range.
rangeLength :: Range -> Int
rangeLength range = end range - start range