From 48aacb98bc295c577b1e70c3f3bb47ef0c147f7b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 3 Mar 2016 08:37:56 -0500 Subject: [PATCH] Simplify the definition of getRange. --- src/Alignment.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Alignment.hs b/src/Alignment.hs index 3ae7a06bb..ca4981550 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -94,10 +94,9 @@ splitAnnotatedByLines sources ranges categories syntax = case syntax of wrap :: Copointed f => ([f (SplitDiff leaf Info)] -> Syntax leaf (SplitDiff leaf Info)) -> Set.Set Category -> [(Range, Maybe (f (SplitDiff leaf Info)))] -> SplitDiff leaf Info wrap constructor categories children = Free . Annotated (Info (unionRanges $ Prelude.fst <$> children) categories) . constructor . catMaybes $ Prelude.snd <$> children - getRange :: Copointed f => f (SplitDiff leaf Info) -> Range - getRange diff = case copoint diff of - (Pure patch) -> characterRange (copoint (getSplitTerm patch)) - (Free (Annotated info _)) -> characterRange info + getRange :: SplitDiff leaf Info -> Range + getRange (Pure patch) = characterRange (copoint (getSplitTerm patch)) + getRange (Free (Annotated info _)) = characterRange info getInfo :: SplitDiff leaf Info -> Info getInfo (Pure patch) = copoint (getSplitTerm patch)