Ide.Plugin.RangeMap

hls-plugin-api-2.9.0.0: Haskell Language Server API for plugin communication

Safe Haskell | None
Language | GHC2021

Ide.Plugin.RangeMap

Description

A map that allows fast "in-range" filtering. `RangeMap` is meant to be constructed once and cached as part of a Shake rule. If not, the map will be rebuilt upon each invocation, yielding slower results compared to the list-based approach!

Note that `RangeMap` falls back to the list-based approach if `use-fingertree` flag of `hls-plugin-api` is set to false.

Synopsis

- newtype RangeMap a = RangeMap {
  - unRangeMap :: IntervalMap Position a
  }
- fromList :: (a -> Range) -> [a] -> RangeMap a
- fromList' :: [(Range, a)] -> RangeMap a
- filterByRange :: Range -> RangeMap a -> [a]

# Documentation

newtype RangeMap a #

A map from code ranges to values.

Constructors

RangeMap |
Fields unRangeMap :: IntervalMap Position a `Interval` of `Position` corresponds to a `Range`

#### Instances

Instances details

Functor RangeMap # |
Instance details Defined in Ide.Plugin.RangeMap Methods fmap :: (a -> b) -> RangeMap a -> RangeMap b # (<$) :: a -> RangeMap b -> RangeMap a #
Foldable RangeMap # |
Instance details Defined in Ide.Plugin.RangeMap Methods fold :: Monoid m => RangeMap m -> m # foldMap :: Monoid m => (a -> m) -> RangeMap a -> m # foldMap' :: Monoid m => (a -> m) -> RangeMap a -> m # foldr :: (a -> b -> b) -> b -> RangeMap a -> b # foldr' :: (a -> b -> b) -> b -> RangeMap a -> b # foldl :: (b -> a -> b) -> b -> RangeMap a -> b # foldl' :: (b -> a -> b) -> b -> RangeMap a -> b # foldr1 :: (a -> a -> a) -> RangeMap a -> a # foldl1 :: (a -> a -> a) -> RangeMap a -> a # toList :: RangeMap a -> [a] # null :: RangeMap a -> Bool # length :: RangeMap a -> Int # elem :: Eq a => a -> RangeMap a -> Bool # maximum :: Ord a => RangeMap a -> a # minimum :: Ord a => RangeMap a -> a # sum :: Num a => RangeMap a -> a # product :: Num a => RangeMap a -> a #
Traversable RangeMap # |
Instance details Defined in Ide.Plugin.RangeMap Methods traverse :: Applicative f => (a -> f b) -> RangeMap a -> f (RangeMap b) # sequenceA :: Applicative f => RangeMap (f a) -> f (RangeMap a) # mapM :: Monad m => (a -> m b) -> RangeMap a -> m (RangeMap b) # sequence :: Monad m => RangeMap (m a) -> m (RangeMap a) #
NFData a => NFData (RangeMap a) # |
Instance details Defined in Ide.Plugin.RangeMap Methods rnf :: RangeMap a -> () #
Monoid (RangeMap a) # |
Instance details Defined in Ide.Plugin.RangeMap Methods mempty :: RangeMap a # mappend :: RangeMap a -> RangeMap a -> RangeMap a # mconcat :: [RangeMap a] -> RangeMap a #
Semigroup (RangeMap a) # |
Instance details Defined in Ide.Plugin.RangeMap Methods (<>) :: RangeMap a -> RangeMap a -> RangeMap a # sconcat :: NonEmpty (RangeMap a) -> RangeMap a # stimes :: Integral b => b -> RangeMap a -> RangeMap a #

fromList :: (a -> Range) -> [a] -> RangeMap a #

Construct a `RangeMap` from a `Range` accessor and a list of values.

fromList' :: [(Range, a)] -> RangeMap a #

filterByRange :: Range -> RangeMap a -> [a] #

Filter a `RangeMap` by a given `Range`.