hls-graph-2.9.0.0: Haskell Language Server internal graph API

Safe Haskell | None
Language | GHC2021

Development.IDE.Graph.Rule

Contents

- Defining builtin rules
- Calling builtin rules

Synopsis

- addRule :: (RuleResult key ~ value, Typeable key, Hashable key, Eq key, Typeable value) => (key -> Maybe ByteString -> RunMode -> Action (RunResult value)) -> Rules ()
- data RunMode
  - = RunDependenciesSame
  - | RunDependenciesChanged
- data RunChanged
  - = ChangedNothing
  - | ChangedRecomputeSame
  - | ChangedRecomputeDiff
- data RunResult value = RunResult {
  - runChanged :: RunChanged
  - runStore :: ByteString
  - runValue :: value
  - runHook :: STM ()
  }
- apply :: (Traversable f, RuleResult key ~ value, ShakeValue key, Typeable value) => f key -> Action (f value)
- apply1 :: (RuleResult key ~ value, ShakeValue key, Typeable value) => key -> Action value
- applyWithoutDependency :: (Traversable f, RuleResult key ~ value, ShakeValue key, Typeable value) => f key -> Action (f value)

# Defining builtin rules

Functions and types for defining new types of Shake rules.

addRule :: (RuleResult key ~ value, Typeable key, Hashable key, Eq key, Typeable value) => (key -> Maybe ByteString -> RunMode -> Action (RunResult value)) -> Rules () #

data RunMode #

What mode a rule is running in, passed as an argument to `BuiltinRun`.

Constructors

RunDependenciesSame | My dependencies have not changed.
RunDependenciesChanged | At least one of my dependencies from last time have changed, or I have no recorded dependencies.

#### Instances

Instances details

NFData RunMode # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods rnf :: RunMode -> () #
Show RunMode # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> RunMode -> ShowS # show :: RunMode -> String # showList :: [RunMode] -> ShowS #
Eq RunMode # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (==) :: RunMode -> RunMode -> Bool # (/=) :: RunMode -> RunMode -> Bool #

data RunChanged #

How the output of a rule has changed.

Constructors

ChangedNothing | Nothing has changed.
ChangedRecomputeSame | I recomputed the value and it was the same.
ChangedRecomputeDiff | I recomputed the value and it was different.

#### Instances

Instances details

FromJSON RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods parseJSON :: Value -> Parser RunChanged # parseJSONList :: Value -> Parser [RunChanged] # omittedField :: Maybe RunChanged #
ToJSON RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods toJSON :: RunChanged -> Value # toEncoding :: RunChanged -> Encoding # toJSONList :: [RunChanged] -> Value # toEncodingList :: [RunChanged] -> Encoding # omitField :: RunChanged -> Bool #
NFData RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods rnf :: RunChanged -> () #
Generic RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Associated Types
type Rep RunChanged |
Instance details Defined in Development.IDE.Graph.Internal.Types type Rep RunChanged = D1 ('MetaData "RunChanged" "Development.IDE.Graph.Internal.Types" "hls-graph-2.9.0.0-BTFwvtRNXWYHYsIjrHY3mj" 'False) (C1 ('MetaCons "ChangedNothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ChangedRecomputeSame" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ChangedRecomputeDiff" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: RunChanged -> Rep RunChanged x # to :: Rep RunChanged x -> RunChanged #
Show RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> RunChanged -> ShowS # show :: RunChanged -> String # showList :: [RunChanged] -> ShowS #
Eq RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (==) :: RunChanged -> RunChanged -> Bool # (/=) :: RunChanged -> RunChanged -> Bool #
type Rep RunChanged # |
Instance details Defined in Development.IDE.Graph.Internal.Types type Rep RunChanged = D1 ('MetaData "RunChanged" "Development.IDE.Graph.Internal.Types" "hls-graph-2.9.0.0-BTFwvtRNXWYHYsIjrHY3mj" 'False) (C1 ('MetaCons "ChangedNothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ChangedRecomputeSame" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ChangedRecomputeDiff" 'PrefixI 'False) (U1 :: Type -> Type)))

data RunResult value #

The result of `BuiltinRun`.

Constructors

RunResult |
Fields runChanged :: RunChanged How has the `RunResult` changed from what happened last time. runStore :: ByteString The value to store in the Shake database. runValue :: value The value to return from `apply`. runHook :: STM () The hook to run at the end of the build in the same transaction when the key is marked as clean.

#### Instances

Instances details

Functor RunResult # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods fmap :: (a -> b) -> RunResult a -> RunResult b # (<$) :: a -> RunResult b -> RunResult a #

# Calling builtin rules

Wrappers around calling Shake rules. In general these should be specialised to a builtin rule.

apply :: (Traversable f, RuleResult key ~ value, ShakeValue key, Typeable value) => f key -> Action (f value) #

apply1 :: (RuleResult key ~ value, ShakeValue key, Typeable value) => key -> Action value #

applyWithoutDependency :: (Traversable f, RuleResult key ~ value, ShakeValue key, Typeable value) => f key -> Action (f value) #

Evaluate a list of keys without recording any dependencies.