HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleAgda-2.7.0.1Haskell2010

Agda.Utils.RangeMap

Maps containing non-overlapping intervals.

  • 2 types
  • 1 class
  • 7 values
  • PackageAgda-2.7.0.1
  • Exports10
  • LanguageHaskell2010
  • LicenceMIT
  • SourceRangeMap.hs
classclass IsBasicRangeMap a m | m -> a where
#

A class that is intended to make it easy to swap between different range map implementations.

Note that some RangeMap operations are not included in this class.

Methods

  • singleton :: Ranges -> a -> m

    The map singleton rs x contains the ranges from rs, and every position in those ranges is associated with x.

  • toMap :: m -> IntMap a

    Converts range maps to IntMaps from positions to values.

  • toList :: m -> [(Range, a)]

    Converts the map to a list. The ranges are non-overlapping and non-empty, and earlier ranges precede later ones in the list.

  • coveringRange :: m -> Maybe Range

    Returns the smallest range covering everything in the map (or Nothing, if the range would be empty).

    Note that the default implementation of this operation might be inefficient.

Instances6IsBasicRangeMap
newtypenewtype PairInt a
#

A strict pair type where the first argument must be an Int.

This type is included because there is no NFData instance for Pair in the package strict before version 4.

Constructors

Instances2Show, NFData
newtypenewtype RangeMap a
#

Maps containing non-overlapping intervals.

The implementation does not use IntMap, because IntMap does not come with a constant-time size function.

Note the invariant which RangeMaps should satisfy (rangeMapInvariant).

Constructors

Instances12IsBasicRangeMap, Show, Semigroup, Monoid, NFData, Null, …
valueinsert :: (a -> a -> a) -> Range -> a -> RangeMap a -> RangeMap a
#

Inserts a value, along with a corresponding Range, into a RangeMap. No attempt is made to merge adjacent ranges with equal values.

The function argument is used to combine values. The inserted value is given as the first argument to the function.

valuesplitAt :: Int -> RangeMap a -> (RangeMap a, RangeMap a)
#

The value of splitAt p f is a pair (f1, f2) which contains everything from f. All the positions in f1 are less than p, and all the positions in f2 are greater than or equal to p.