1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Define a point fiunction for Range.

This commit is contained in:
Rob Rix 2019-09-20 17:00:24 -04:00
parent 0312300a40
commit e08a49596e
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,6 +1,7 @@
{-# LANGUAGE DeriveGeneric, RankNTypes #-}
module Source.Range
( Range(..)
, point
, rangeLength
, subtractRange
-- * Lenses
@ -32,6 +33,9 @@ instance Lower Range where
lowerBound = Range 0 0
point :: Int -> Range
point i = Range i i
-- | Return the length of the range.
rangeLength :: Range -> Int
rangeLength range = end range - start range