ghcide-2.9.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Types.Shake

Synopsis

- newtype Q k = Q (k, NormalizedFilePath)
- newtype A v = A (Value v)
- data Value v
  - = Succeeded (Maybe FileVersion) v
  - | Stale (Maybe PositionDelta) (Maybe FileVersion) v
  - | Failed Bool
- data ValueWithDiagnostics = ValueWithDiagnostics !(Value Dynamic) !(Vector FileDiagnostic)
- type Values = Map Key ValueWithDiagnostics
- data Key
- newtype BadDependency = BadDependency String
- data ShakeValue
  - = ShakeNoCutoff
  - | ShakeResult !ByteString
  - | ShakeStale !ByteString
- currentValue :: Value v -> Maybe v
- isBadDependency :: SomeException -> Bool
- toShakeValue :: (ByteString -> ShakeValue) -> Maybe ByteString -> ShakeValue
- encodeShakeValue :: ShakeValue -> ByteString
- decodeShakeValue :: ByteString -> ShakeValue
- toKey :: ShakeValue k => k -> NormalizedFilePath -> Key
- toNoFileKey :: (Show k, Typeable k, Eq k, Hashable k) => k -> Key
- fromKey :: Typeable k => Key -> Maybe (k, NormalizedFilePath)
- fromKeyType :: Key -> Maybe (SomeTypeRep, NormalizedFilePath)
- type WithHieDb = forall a. (HieDb -> IO a) -> IO a
- newtype WithHieDbShield = WithHieDbShield WithHieDb

# Documentation

newtype Q k #

Constructors

Q (k, NormalizedFilePath) |

#### Instances

Instances details

NFData k => NFData (Q k) # |
Instance details Defined in Development.IDE.Types.Shake Methods rnf :: Q k -> () #
Show k => Show (Q k) # |
Instance details Defined in Development.IDE.Types.Shake Methods showsPrec :: Int -> Q k -> ShowS # show :: Q k -> String # showList :: [Q k] -> ShowS #
Eq k => Eq (Q k) # |
Instance details Defined in Development.IDE.Types.Shake Methods (==) :: Q k -> Q k -> Bool # (/=) :: Q k -> Q k -> Bool #
Hashable k => Hashable (Q k) # |
Instance details Defined in Development.IDE.Types.Shake Methods hashWithSalt :: Int -> Q k -> Int # hash :: Q k -> Int #
type RuleResult (Q k) # |
Instance details Defined in Development.IDE.Types.Shake type RuleResult (Q k) = A (RuleResult k)

newtype A v #

Invariant: the `v` must be in normal form (fully evaluated). Otherwise we keep repeatedly `rnf`ing values taken from the Shake database

Constructors

A (Value v) |

#### Instances

Instances details

NFData (A v) # |
Instance details Defined in Development.IDE.Types.Shake Methods rnf :: A v -> () #
Show v => Show (A v) # |
Instance details Defined in Development.IDE.Types.Shake Methods showsPrec :: Int -> A v -> ShowS # show :: A v -> String # showList :: [A v] -> ShowS #

data Value v #

Constructors

Succeeded (Maybe FileVersion) v |
Stale (Maybe PositionDelta) (Maybe FileVersion) v |
Failed Bool |

#### Instances

Instances details

Functor Value # |
Instance details Defined in Development.IDE.Types.Shake Methods fmap :: (a -> b) -> Value a -> Value b # (<$) :: a -> Value b -> Value a #
NFData v => NFData (Value v) # |
Instance details Defined in Development.IDE.Types.Shake Methods rnf :: Value v -> () #
Generic (Value v) # |
Instance details Defined in Development.IDE.Types.Shake Associated Types
type Rep (Value v) |
Instance details Defined in Development.IDE.Types.Shake type Rep (Value v) = D1 ('MetaData "Value" "Development.IDE.Types.Shake" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "Succeeded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FileVersion)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v)) :+: (C1 ('MetaCons "Stale" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe PositionDelta)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FileVersion)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v))) :+: C1 ('MetaCons "Failed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))
Methods from :: Value v -> Rep (Value v) x # to :: Rep (Value v) x -> Value v #
Show v => Show (Value v) # |
Instance details Defined in Development.IDE.Types.Shake Methods showsPrec :: Int -> Value v -> ShowS # show :: Value v -> String # showList :: [Value v] -> ShowS #
type Rep (Value v) # |
Instance details Defined in Development.IDE.Types.Shake type Rep (Value v) = D1 ('MetaData "Value" "Development.IDE.Types.Shake" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "Succeeded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FileVersion)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v)) :+: (C1 ('MetaCons "Stale" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe PositionDelta)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FileVersion)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v))) :+: C1 ('MetaCons "Failed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

data ValueWithDiagnostics #

Constructors

ValueWithDiagnostics !(Value Dynamic) !(Vector FileDiagnostic) |

type Values = Map Key ValueWithDiagnostics #

The state of the all values and diagnostics

data Key #

#### Instances

Instances details

Show Key |
Instance details Defined in Development.IDE.Graph.Internal.Key Methods showsPrec :: Int -> Key -> ShowS # show :: Key -> String # showList :: [Key] -> ShowS #
Eq Key |
Instance details Defined in Development.IDE.Graph.Internal.Key Methods (==) :: Key -> Key -> Bool # (/=) :: Key -> Key -> Bool #
Hashable Key |
Instance details Defined in Development.IDE.Graph.Internal.Key Methods hashWithSalt :: Int -> Key -> Int # hash :: Key -> Int #

newtype BadDependency #

When we depend on something that reported an error, and we fail as a direct result, throw BadDependency which short-circuits the rest of the action

Constructors

BadDependency String |

#### Instances

Instances details

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

data ShakeValue #

Constructors

ShakeNoCutoff | This is what we use when we get Nothing from a rule.
ShakeResult !ByteString | This is used both for `Failed` as well as `Succeeded`.
ShakeStale !ByteString |

#### Instances

Instances details

NFData ShakeValue # |
Instance details Defined in Development.IDE.Types.Shake Methods rnf :: ShakeValue -> () #
Generic ShakeValue # |
Instance details Defined in Development.IDE.Types.Shake Associated Types
type Rep ShakeValue |
Instance details Defined in Development.IDE.Types.Shake type Rep ShakeValue = D1 ('MetaData "ShakeValue" "Development.IDE.Types.Shake" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "ShakeNoCutoff" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ShakeResult" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "ShakeStale" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))))
Methods from :: ShakeValue -> Rep ShakeValue x # to :: Rep ShakeValue x -> ShakeValue #
Show ShakeValue # |
Instance details Defined in Development.IDE.Types.Shake Methods showsPrec :: Int -> ShakeValue -> ShowS # show :: ShakeValue -> String # showList :: [ShakeValue] -> ShowS #
type Rep ShakeValue # |
Instance details Defined in Development.IDE.Types.Shake type Rep ShakeValue = D1 ('MetaData "ShakeValue" "Development.IDE.Types.Shake" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "ShakeNoCutoff" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ShakeResult" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "ShakeStale" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))))

currentValue :: Value v -> Maybe v #

Convert a Value to a Maybe. This will only return `Just` for up2date results not for stale values.

isBadDependency :: SomeException -> Bool #

toShakeValue :: (ByteString -> ShakeValue) -> Maybe ByteString -> ShakeValue #

encodeShakeValue :: ShakeValue -> ByteString #

decodeShakeValue :: ByteString -> ShakeValue #

toKey :: ShakeValue k => k -> NormalizedFilePath -> Key #

toNoFileKey :: (Show k, Typeable k, Eq k, Hashable k) => k -> Key #

fromKey :: Typeable k => Key -> Maybe (k, NormalizedFilePath) #

fromKeyType :: Key -> Maybe (SomeTypeRep, NormalizedFilePath) #

fromKeyType (Q (k,f)) = (typeOf k, f)

type WithHieDb = forall a. (HieDb -> IO a) -> IO a #

Intended to represent HieDb calls wrapped with (currently) retry functionality

newtype WithHieDbShield #

Constructors

WithHieDbShield WithHieDb |