1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Generalize totalRange to arbitrary Foldables.

This commit is contained in:
Rob Rix 2016-03-09 01:43:22 -05:00
parent 086a3d53cb
commit 67fd5c3da4

View File

@ -28,8 +28,8 @@ sublist :: Range -> [a] -> [a]
sublist range = take (rangeLength range) . drop (start range)
-- | Return a range that covers the entire text.
totalRange :: T.Text -> Range
totalRange t = Range 0 $ T.length t
totalRange :: Foldable f => f a -> Range
totalRange t = Range 0 $ length t
-- | Return a range that has its start and end offset by the given amount.
offsetRange :: Int -> Range -> Range