| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mikan.Utils.Range
Description
Ranges.
Synopsis
- data Range = Range {}
- newtype Ranges = Ranges [Range]
- empty :: Null a => a
- overlapping :: Range -> Range -> Bool
- overlappings :: Ranges -> Ranges -> Bool
- rangeToPositions :: Range -> [Int]
- rangesToPositions :: Ranges -> [Int]
- minus :: Ranges -> Ranges -> Ranges
- rangeInvariant :: Range -> Bool
- rangesInvariant :: Ranges -> Bool
Documentation
Character ranges. The first character in the file has position 1.
Note that the to position is considered to be outside of the
range.
Zero or more consecutive and separated ranges.
Construction
Queries
overlapping :: Range -> Range -> Bool Source #
True iff the ranges overlap.
The ranges are assumed to be well-formed.
Conversion
rangeToPositions :: Range -> [Int] Source #
Converts a range to a list of positions.
rangesToPositions :: Ranges -> [Int] Source #
Converts several ranges to a list of positions.
Operations
minus :: Ranges -> Ranges -> Ranges Source #
minus xs ys computes the difference between xs and ys: the
result contains those positions which are present in xs but not
in ys.
Linear in the lengths of the input ranges.