Development.IDE.Graph.Internal.Types

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

Safe Haskell | None
Language | GHC2021

Development.IDE.Graph.Internal.Types

Synopsis

- unwrapDynamic :: Typeable a => Dynamic -> a
- type TheRules = HashMap TypeRep Dynamic
- newtype Rules a = Rules (ReaderT SRules IO a)
- data SRules = SRules {
  - rulesExtra :: !Dynamic
  - rulesActions :: !(IORef [Action ()])
  - rulesMap :: !(IORef TheRules)
  }
- newtype Action a = Action {
  - fromAction :: ReaderT SAction IO a
  }
- data SAction = SAction {
  - actionDatabase :: !Database
  - actionDeps :: !(IORef ResultDeps)
  - actionStack :: !Stack
  }
- getDatabase :: Action Database
- waitForDatabaseRunningKeysAction :: Action ()
- data ShakeDatabase = ShakeDatabase !Int [Action ()] Database
- newtype Step = Step Int
- newtype Value = Value Dynamic
- data KeyDetails = KeyDetails {
  - keyStatus :: !Status
  - keyReverseDeps :: !KeySet
  }
- onKeyReverseDeps :: (KeySet -> KeySet) -> KeyDetails -> KeyDetails
- data Database = Database {
  - databaseExtra :: Dynamic
  - databaseRules :: TheRules
  - databaseStep :: !(TVar Step)
  - databaseValues :: !(Map Key KeyDetails)
  }
- waitForDatabaseRunningKeys :: Database -> IO ()
- getDatabaseValues :: Database -> IO [(Key, Status)]
- data Status
  - = Clean !Result
  - | Dirty (Maybe Result)
  - | Running {
    - runningStep :: !Step
    - runningWait :: !(IO ())
    - runningResult :: Result
    - runningPrev :: !(Maybe Result)
    }
- viewDirty :: Step -> Status -> Status
- getResult :: Status -> Maybe Result
- waitRunning :: Status -> IO ()
- data Result = Result {
  - resultValue :: !Value
  - resultBuilt :: !Step
  - resultChanged :: !Step
  - resultVisited :: !Step
  - resultDeps :: !ResultDeps
  - resultExecution :: !Seconds
  - resultData :: !ByteString
  }
- data ResultDeps
  - = UnknownDeps
  - | AlwaysRerunDeps !KeySet
  - | ResultDeps ![KeySet]
- getResultDepsDefault :: KeySet -> ResultDeps -> KeySet
- mapResultDeps :: (KeySet -> KeySet) -> ResultDeps -> ResultDeps
- data RunMode
  - = RunDependenciesSame
  - | RunDependenciesChanged
- data RunChanged
  - = ChangedNothing
  - | ChangedRecomputeSame
  - | ChangedRecomputeDiff
- data RunResult value = RunResult {
  - runChanged :: RunChanged
  - runStore :: ByteString
  - runValue :: value
  - runHook :: STM ()
  }
- data GraphException = Exception e => GraphException {
  - target :: String
  - stack :: [String]
  - inner :: e
  }
- fromGraphException :: Typeable b => SomeException -> Maybe b
- data Stack = Stack [Key] !KeySet
- newtype StackException = StackException Stack
- addStack :: Key -> Stack -> Either StackException Stack
- memberStack :: Key -> Stack -> Bool
- emptyStack :: Stack

# Documentation

unwrapDynamic :: Typeable a => Dynamic -> a #

type TheRules = HashMap TypeRep Dynamic #

newtype Rules a #

A computation that defines all the rules that form part of the computation graph.

`Rules` has access to `IO` through `MonadIO`. Use of `IO` is at your own risk: if you write `Rules` that throw exceptions, then you need to make sure to handle them yourself when you run the resulting `Rules`.

Constructors

Rules (ReaderT SRules IO a) |

#### Instances

Instances details

MonadIO Rules # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods liftIO :: IO a -> Rules a #
Applicative Rules # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods pure :: a -> Rules a # (<*>) :: Rules (a -> b) -> Rules a -> Rules b # liftA2 :: (a -> b -> c) -> Rules a -> Rules b -> Rules c # (*>) :: Rules a -> Rules b -> Rules b # (<*) :: Rules a -> Rules b -> Rules a #
Functor Rules # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods fmap :: (a -> b) -> Rules a -> Rules b # (<$) :: a -> Rules b -> Rules a #
Monad Rules # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (>>=) :: Rules a -> (a -> Rules b) -> Rules b # (>>) :: Rules a -> Rules b -> Rules b # return :: a -> Rules a #
Monoid a => Monoid (Rules a) # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods mempty :: Rules a # mappend :: Rules a -> Rules a -> Rules a # mconcat :: [Rules a] -> Rules a #
Semigroup a => Semigroup (Rules a) # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (<>) :: Rules a -> Rules a -> Rules a # sconcat :: NonEmpty (Rules a) -> Rules a # stimes :: Integral b => b -> Rules a -> Rules a #

data SRules #

Constructors

SRules |
Fields rulesExtra :: !Dynamic rulesActions :: !(IORef [Action ()]) rulesMap :: !(IORef TheRules)

newtype Action a #

An action representing something that can be run as part of a `Rule`.

`Action`s can be pure functions but also have access to `IO` via `MonadIO` and 'MonadUnliftIO. It should be assumed that actions throw exceptions, these can be caught with `actionCatch`. In particular, it is permissible to use the `MonadFail` instance, which will lead to an `IOException`.

Constructors

Action |
Fields fromAction :: ReaderT SAction IO a

#### Instances

Instances details

MonadIO Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods liftIO :: IO a -> Action a #
MonadCatch Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods catch :: (HasCallStack, Exception e) => Action a -> (e -> Action a) -> Action a #
MonadMask Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods mask :: HasCallStack => ((forall a. Action a -> Action a) -> Action b) -> Action b # uninterruptibleMask :: HasCallStack => ((forall a. Action a -> Action a) -> Action b) -> Action b # generalBracket :: HasCallStack => Action a -> (a -> ExitCase b -> Action c) -> (a -> Action b) -> Action (b, c) #
MonadThrow Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods throwM :: (HasCallStack, Exception e) => e -> Action a #
Applicative Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods pure :: a -> Action a # (<*>) :: Action (a -> b) -> Action a -> Action b # liftA2 :: (a -> b -> c) -> Action a -> Action b -> Action c # (*>) :: Action a -> Action b -> Action b # (<*) :: Action a -> Action b -> Action a #
Functor Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods fmap :: (a -> b) -> Action a -> Action b # (<$) :: a -> Action b -> Action a #
Monad Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (>>=) :: Action a -> (a -> Action b) -> Action b # (>>) :: Action a -> Action b -> Action b # return :: a -> Action a #
MonadFail Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods fail :: String -> Action a #
MonadUnliftIO Action # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods withRunInIO :: ((forall a. Action a -> IO a) -> IO b) -> Action b #

data SAction #

Constructors

SAction |
Fields actionDatabase :: !Database actionDeps :: !(IORef ResultDeps) actionStack :: !Stack

getDatabase :: Action Database #

waitForDatabaseRunningKeysAction :: Action () #

waitForDatabaseRunningKeysAction waits for all keys in the database to finish running.

data ShakeDatabase #

Constructors

ShakeDatabase !Int [Action ()] Database |

newtype Step #

Constructors

Step Int |

#### Instances

Instances details

Show Step # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> Step -> ShowS # show :: Step -> String # showList :: [Step] -> ShowS #
Eq Step # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (==) :: Step -> Step -> Bool # (/=) :: Step -> Step -> Bool #
Ord Step # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods compare :: Step -> Step -> Ordering # (<) :: Step -> Step -> Bool # (<=) :: Step -> Step -> Bool # (>) :: Step -> Step -> Bool # (>=) :: Step -> Step -> Bool # max :: Step -> Step -> Step # min :: Step -> Step -> Step #
Hashable Step # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods hashWithSalt :: Int -> Step -> Int # hash :: Step -> Int #

newtype Value #

Constructors

Value Dynamic |

data KeyDetails #

Constructors

KeyDetails |
Fields keyStatus :: !Status keyReverseDeps :: !KeySet

onKeyReverseDeps :: (KeySet -> KeySet) -> KeyDetails -> KeyDetails #

data Database #

Constructors

Database |
Fields databaseExtra :: Dynamic databaseRules :: TheRules databaseStep :: !(TVar Step) databaseValues :: !(Map Key KeyDetails)

waitForDatabaseRunningKeys :: Database -> IO () #

getDatabaseValues :: Database -> IO [(Key, Status)] #

data Status #

Constructors

Clean !Result |
Dirty (Maybe Result) |
Running |
Fields runningStep :: !Step runningWait :: !(IO ()) runningResult :: Result runningPrev :: !(Maybe Result)

viewDirty :: Step -> Status -> Status #

getResult :: Status -> Maybe Result #

waitRunning :: Status -> IO () #

data Result #

Constructors

Result |
Fields resultValue :: !Value resultBuilt :: !Step the step when it was last recomputed resultChanged :: !Step the step when it last changed resultVisited :: !Step the step when it was last looked up resultDeps :: !ResultDeps resultExecution :: !Seconds How long it took, last time it ran resultData :: !ByteString

data ResultDeps #

Constructors

UnknownDeps |
AlwaysRerunDeps !KeySet |
ResultDeps ![KeySet] |

#### Instances

Instances details

Monoid ResultDeps # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods mempty :: ResultDeps # mappend :: ResultDeps -> ResultDeps -> ResultDeps # mconcat :: [ResultDeps] -> ResultDeps #
Semigroup ResultDeps # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (<>) :: ResultDeps -> ResultDeps -> ResultDeps # sconcat :: NonEmpty ResultDeps -> ResultDeps # stimes :: Integral b => b -> ResultDeps -> ResultDeps #
Show ResultDeps # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> ResultDeps -> ShowS # show :: ResultDeps -> String # showList :: [ResultDeps] -> ShowS #
Eq ResultDeps # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods (==) :: ResultDeps -> ResultDeps -> Bool # (/=) :: ResultDeps -> ResultDeps -> Bool #

getResultDepsDefault :: KeySet -> ResultDeps -> KeySet #

mapResultDeps :: (KeySet -> KeySet) -> ResultDeps -> ResultDeps #

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 #

data GraphException #

Constructors

Exception e => GraphException |
Fields target :: String The key that was being built stack :: [String] The stack of keys that led to this exception inner :: e The underlying exception

#### Instances

Instances details

Exception GraphException # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods toException :: GraphException -> SomeException # fromException :: SomeException -> Maybe GraphException # displayException :: GraphException -> String # backtraceDesired :: GraphException -> Bool #
Show GraphException # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> GraphException -> ShowS # show :: GraphException -> String # showList :: [GraphException] -> ShowS #

fromGraphException :: Typeable b => SomeException -> Maybe b #

data Stack #

Constructors

Stack [Key] !KeySet |

#### Instances

Instances details

Show Stack # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> Stack -> ShowS # show :: Stack -> String # showList :: [Stack] -> ShowS #

newtype StackException #

Constructors

StackException Stack |

#### Instances

Instances details

Exception StackException # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods toException :: StackException -> SomeException # fromException :: SomeException -> Maybe StackException # displayException :: StackException -> String # backtraceDesired :: StackException -> Bool #
Show StackException # |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods showsPrec :: Int -> StackException -> ShowS # show :: StackException -> String # showList :: [StackException] -> ShowS #

addStack :: Key -> Stack -> Either StackException Stack #

memberStack :: Key -> Stack -> Bool #

emptyStack :: Stack #