diff --git a/src/Range.hs b/src/Range.hs index 1a6806b64..58dede3d1 100644 --- a/src/Range.hs +++ b/src/Range.hs @@ -34,6 +34,7 @@ rangesAndWordsFrom startIndex string = maybe [] id $ takeAndContinue <$> (word < -- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_ isWord c = Char.isLetter c || Char.isNumber c || Char.isMark c || Char.generalCategory c == Char.ConnectorPunctuation +-- | Return Just the last index from a non-empty range, or if the range is empty, Nothing. maybeLastIndex :: Range -> Maybe Int maybeLastIndex (Range start end) | start == end = Nothing maybeLastIndex (Range _ end) = Just $ end - 1