1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Add a rangeAt function to construct a Range at an index.

This commit is contained in:
Rob Rix 2016-02-29 10:00:02 -05:00
parent 5bbca4cf8d
commit 9108b56e4f

View File

@ -11,6 +11,10 @@ import Data.Option
data Range = Range { start :: !Int, end :: !Int }
deriving (Eq, Show)
-- | Make a range at a given index.
rangeAt :: Int -> Range
rangeAt a = Range a a
-- | Return the length of the range.
rangeLength :: Range -> Int
rangeLength range = end range - start range