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:
parent
0312300a40
commit
e08a49596e
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user