ghcide-2.9.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Core.UseStale

Synopsis

- data Age
  - = Current
  - | Stale Type
- data Tracked (age :: Age) a
- unTrack :: Tracked age a -> a
- data PositionMap (from :: Age) (to :: Age)
- data TrackedStale a where
  - TrackedStale :: forall s a. Tracked ('Stale s) a -> PositionMap ('Stale s) 'Current -> TrackedStale a
- untrackedStaleValue :: TrackedStale a -> a
- unsafeMkStale :: age -> Tracked ('Stale s) age
- unsafeMkCurrent :: age -> Tracked 'Current age
- unsafeCopyAge :: forall (age :: Age) a b. Tracked age a -> b -> Tracked age b
- class MapAge a where
  - mapAgeFrom :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked to a -> Maybe (Tracked from a)
  - mapAgeTo :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked from a -> Maybe (Tracked to a)
- dualPositionMap :: forall (from :: Age) (to :: Age). PositionMap from to -> PositionMap to from
- useWithStale :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe (TrackedStale v))
- useWithStale_ :: IdeRule k v => k -> NormalizedFilePath -> Action (TrackedStale v)

# Documentation

data Age #

A data kind for `Tracked`.

Constructors

Current |
Stale Type |

#### Instances

Instances details

Category PositionMap # |
Instance details Defined in Development.IDE.Core.UseStale Methods id :: forall (a :: Age). PositionMap a a # (.) :: forall (b :: Age) (c :: Age) (a :: Age). PositionMap b c -> PositionMap a b -> PositionMap a c #

data Tracked (age :: Age) a #

Some value, tagged with its age. All `Current` ages are considered to be the same thing, but `Stale` values are protected by an untouchable variable to ensure they can't be unified.

#### Instances

Instances details

Applicative (Tracked age) # |
Instance details Defined in Development.IDE.Core.UseStale Methods pure :: a -> Tracked age a # (<*>) :: Tracked age (a -> b) -> Tracked age a -> Tracked age b # liftA2 :: (a -> b -> c) -> Tracked age a -> Tracked age b -> Tracked age c # (*>) :: Tracked age a -> Tracked age b -> Tracked age b # (<*) :: Tracked age a -> Tracked age b -> Tracked age a #
Functor (Tracked age) # |
Instance details Defined in Development.IDE.Core.UseStale Methods fmap :: (a -> b) -> Tracked age a -> Tracked age b # (<$) :: a -> Tracked age b -> Tracked age a #
Monad (Tracked age) # |
Instance details Defined in Development.IDE.Core.UseStale Methods (>>=) :: Tracked age a -> (a -> Tracked age b) -> Tracked age b # (>>) :: Tracked age a -> Tracked age b -> Tracked age b # return :: a -> Tracked age a #
Foldable (Tracked age) # |

Instance details

Defined in Development.IDE.Core.UseStale

Methods

fold :: Monoid m => Tracked age m -> m #

foldMap :: Monoid m => (a -> m) -> Tracked age a -> m #

foldMap' :: Monoid m => (a -> m) -> Tracked age a -> m #

foldr :: (a -> b -> b) -> b -> Tracked age a -> b #

foldr' :: (a -> b -> b) -> b -> Tracked age a -> b #

foldl :: (b -> a -> b) -> b -> Tracked age a -> b #

foldl' :: (b -> a -> b) -> b -> Tracked age a -> b #

foldr1 :: (a -> a -> a) -> Tracked age a -> a #

foldl1 :: (a -> a -> a) -> Tracked age a -> a #

toList :: Tracked age a -> [a] #

null :: Tracked age a -> Bool #

length :: Tracked age a -> Int #

elem :: Eq a => a -> Tracked age a -> Bool #

maximum :: Ord a => Tracked age a -> a #

minimum :: Ord a => Tracked age a -> a #

sum :: Num a => Tracked age a -> a #

product :: Num a => Tracked age a -> a #

Traversable (Tracked age) # |
Instance details Defined in Development.IDE.Core.UseStale Methods traverse :: Applicative f => (a -> f b) -> Tracked age a -> f (Tracked age b) # sequenceA :: Applicative f => Tracked age (f a) -> f (Tracked age a) # mapM :: Monad m => (a -> m b) -> Tracked age a -> m (Tracked age b) # sequence :: Monad m => Tracked age (m a) -> m (Tracked age a) #
FromJSON a => FromJSON (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods parseJSON :: Value -> Parser (Tracked age a) # parseJSONList :: Value -> Parser [Tracked age a] # omittedField :: Maybe (Tracked age a) #
ToJSON a => ToJSON (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods toJSON :: Tracked age a -> Value # toEncoding :: Tracked age a -> Encoding # toJSONList :: [Tracked age a] -> Value # toEncodingList :: [Tracked age a] -> Encoding # omitField :: Tracked age a -> Bool #
NFData a => NFData (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods rnf :: Tracked age a -> () #
Read a => Read (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods readsPrec :: Int -> ReadS (Tracked age a) # readList :: ReadS [Tracked age a] # readPrec :: ReadPrec (Tracked age a) # readListPrec :: ReadPrec [Tracked age a] #
Show a => Show (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods showsPrec :: Int -> Tracked age a -> ShowS # show :: Tracked age a -> String # showList :: [Tracked age a] -> ShowS #
Eq a => Eq (Tracked age a) # |
Instance details Defined in Development.IDE.Core.UseStale Methods (==) :: Tracked age a -> Tracked age a -> Bool # (/=) :: Tracked age a -> Tracked age a -> Bool #
Ord a => Ord (Tracked age a) # |

Instance details

Defined in Development.IDE.Core.UseStale

Methods

compare :: Tracked age a -> Tracked age a -> Ordering #

(<) :: Tracked age a -> Tracked age a -> Bool #

(<=) :: Tracked age a -> Tracked age a -> Bool #

(>) :: Tracked age a -> Tracked age a -> Bool #

(>=) :: Tracked age a -> Tracked age a -> Bool #

max :: Tracked age a -> Tracked age a -> Tracked age a #

min :: Tracked age a -> Tracked age a -> Tracked age a #

unTrack :: Tracked age a -> a #

data PositionMap (from :: Age) (to :: Age) #

Like `PositionMapping`, but with annotated ages for how `Tracked` values change. Use the `Category` instance to compose `PositionMapping`s in order to transform between values of different stale ages.

#### Instances

Instances details

Category PositionMap # |
Instance details Defined in Development.IDE.Core.UseStale Methods id :: forall (a :: Age). PositionMap a a # (.) :: forall (b :: Age) (c :: Age) (a :: Age). PositionMap b c -> PositionMap a b -> PositionMap a c #

data TrackedStale a where #

A pair containing a ``Tracked` `Stale`` value, as well as a `PositionMapping` that will fast-forward values to the current age.

Constructors

TrackedStale :: forall s a. Tracked ('Stale s) a -> PositionMap ('Stale s) 'Current -> TrackedStale a |

#### Instances

Instances details

Functor TrackedStale # |
Instance details Defined in Development.IDE.Core.UseStale Methods fmap :: (a -> b) -> TrackedStale a -> TrackedStale b # (<$) :: a -> TrackedStale b -> TrackedStale a #

untrackedStaleValue :: TrackedStale a -> a #

unsafeMkStale :: age -> Tracked ('Stale s) age #

unsafeMkCurrent :: age -> Tracked 'Current age #

unsafeCopyAge :: forall (age :: Age) a b. Tracked age a -> b -> Tracked age b #

class MapAge a where #

A class for which `Tracked` values can be run across a `PositionMapping` to change their ages.

Minimal complete definition

mapAgeFrom | mapAgeTo

Methods

mapAgeFrom :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked to a -> Maybe (Tracked from a) #

mapAgeTo :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked from a -> Maybe (Tracked to a) #

#### Instances

Instances details

MapAge RealSrcSpan # |
Instance details Defined in Development.IDE.Core.UseStale Methods mapAgeFrom :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked to RealSrcSpan -> Maybe (Tracked from RealSrcSpan) # mapAgeTo :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked from RealSrcSpan -> Maybe (Tracked to RealSrcSpan) #
MapAge Range # |
Instance details Defined in Development.IDE.Core.UseStale Methods mapAgeFrom :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked to Range -> Maybe (Tracked from Range) # mapAgeTo :: forall (from :: Age) (to :: Age). PositionMap from to -> Tracked from Range -> Maybe (Tracked to Range) #

dualPositionMap :: forall (from :: Age) (to :: Age). PositionMap from to -> PositionMap to from #

Get a `PositionMap` that runs in the opposite direction.

useWithStale :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe (TrackedStale v)) #

Request a Rule result, it not available return the last computed result, if any, which may be stale

useWithStale_ :: IdeRule k v => k -> NormalizedFilePath -> Action (TrackedStale v) #

Request a Rule result, it not available return the last computed result which may be stale. Errors out if none available.