From 9981e98a774465a2caa75f7bb8d20e2e65a00171 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 3 Mar 2016 10:42:03 -0500 Subject: [PATCH] Revert "Move safeRange into the Range module." This reverts commit 781f940cad93db3954ddb9f2ddd9de23c432a68f. --- src/Alignment.hs | 4 ++++ src/Range.hs | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Alignment.hs b/src/Alignment.hs index cd8b69694..b79d9ffbd 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -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 diff --git a/src/Range.hs b/src/Range.hs index e8d366429..77f58569f 100644 --- a/src/Range.hs +++ b/src/Range.hs @@ -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