Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Interaction.Highlighting.Range

Description

Ranges.

Synopsis

- data Range = Range {
  - from, to :: Int
  }
- rangeInvariant :: Range -> Bool
- newtype Ranges = Ranges [Range]
- rangesInvariant :: Ranges -> Bool
- overlapping :: Range -> Range -> Bool
- empty :: Range -> Bool
- rangeToPositions :: Range -> [Int]
- rangesToPositions :: Ranges -> [Int]
- rToR :: Range -> Ranges
- rangeToEndPoints :: Range -> Maybe (Int, Int)
- minus :: Ranges -> Ranges -> Ranges

# Documentation

data Range #

Character ranges. The first character in the file has position 1. Note that the `to` position is considered to be outside of the range.

Invariant: ``from` `<=` `to``.

Constructors

Range |
Fields from, to :: Int

Instances

Eq Range # |
Methods (==) :: Range -> Range -> Bool # (/=) :: Range -> Range -> Bool #
Ord Range # |
Methods compare :: Range -> Range -> Ordering # (<) :: Range -> Range -> Bool # (<=) :: Range -> Range -> Bool # (>) :: Range -> Range -> Bool # (>=) :: Range -> Range -> Bool # max :: Range -> Range -> Range # min :: Range -> Range -> Range #
Show Range # |
Methods showsPrec :: Int -> Range -> ShowS # show :: Range -> String # showList :: [Range] -> ShowS #

rangeInvariant :: Range -> Bool #

The `Range` invariant.

newtype Ranges #

Zero or more consecutive and separated ranges.

Constructors

Ranges [Range] |

Instances

Eq Ranges # |
Methods (==) :: Ranges -> Ranges -> Bool # (/=) :: Ranges -> Ranges -> Bool #
Show Ranges # |
Methods showsPrec :: Int -> Ranges -> ShowS # show :: Ranges -> String # showList :: [Ranges] -> ShowS #

rangesInvariant :: Ranges -> Bool #

The `Ranges` invariant.

overlapping :: Range -> Range -> Bool #

`True` iff the ranges overlap.

The ranges are assumed to be well-formed.

empty :: Range -> Bool #

`True` iff the range is empty.

rangeToPositions :: Range -> [Int] #

Converts a range to a list of positions.

rangesToPositions :: Ranges -> [Int] #

Converts several ranges to a list of positions.

rToR :: Range -> Ranges #

Converts a `Range` to a `Ranges`.

rangeToEndPoints :: Range -> Maybe (Int, Int) #

minus :: Ranges -> Ranges -> Ranges #

`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.