mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Add a rangeAt function to construct a Range at an index.
This commit is contained in:
parent
5bbca4cf8d
commit
9108b56e4f
@ -11,6 +11,10 @@ import Data.Option
|
|||||||
data Range = Range { start :: !Int, end :: !Int }
|
data Range = Range { start :: !Int, end :: !Int }
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
-- | Make a range at a given index.
|
||||||
|
rangeAt :: Int -> Range
|
||||||
|
rangeAt a = Range a a
|
||||||
|
|
||||||
-- | Return the length of the range.
|
-- | Return the length of the range.
|
||||||
rangeLength :: Range -> Int
|
rangeLength :: Range -> Int
|
||||||
rangeLength range = end range - start range
|
rangeLength range = end range - start range
|
||||||
|
Loading…
Reference in New Issue
Block a user