1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 21:16:12 +03:00

Document maybeLastIndex.

This commit is contained in:
Rob Rix 2015-12-21 12:22:52 -05:00
parent e823fb6281
commit 1e2c1979ee

View File

@ -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