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 #-} {-# LANGUAGE DeriveGeneric, RankNTypes #-}
module Source.Range module Source.Range
( Range(..) ( Range(..)
, point
, rangeLength , rangeLength
, subtractRange , subtractRange
-- * Lenses -- * Lenses
@ -32,6 +33,9 @@ instance Lower Range where
lowerBound = Range 0 0 lowerBound = Range 0 0
point :: Int -> Range
point i = Range i i
-- | 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