Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
GHC.Iface.Ext.Utils
Synopsis
- type RefMap a = Map Identifier [(Span, IdentifierDetails a)]
- generateReferencesMap :: Foldable f => f (HieAST a) -> RefMap a
- renderHieType :: DynFlags -> HieTypeFix -> String
- resolveVisibility :: Type -> [Type] -> [(Bool, Type)]
- foldType :: (HieType a -> a) -> HieTypeFix -> a
- selectPoint :: HieFile -> (Int, Int) -> Maybe (HieAST Int)
- findEvidenceUse :: NodeIdentifiers a -> [Name]
- data EvidenceInfo a = EvidenceInfo {
- evidenceVar :: Name
- evidenceSpan :: RealSrcSpan
- evidenceType :: a
- evidenceDetails :: Maybe (EvVarSource, Scope, Maybe Span)
- getEvidenceTreesAtPoint :: HieFile -> RefMap a -> (Int, Int) -> Forest (EvidenceInfo a)
- getEvidenceTree :: RefMap a -> Name -> Maybe (Tree (EvidenceInfo a))
- hieTypeToIface :: HieTypeFix -> IfaceType
- data HieTypeState = HTS {
- tyMap :: !(TypeMap TypeIndex)
- htyTable :: !(IntMap HieTypeFlat)
- freshIndex :: !TypeIndex
- initialHTS :: HieTypeState
- freshTypeIndex :: State HieTypeState TypeIndex
- compressTypes :: HieASTs Type -> (HieASTs TypeIndex, Array TypeIndex HieTypeFlat)
- recoverFullType :: TypeIndex -> Array TypeIndex HieTypeFlat -> HieTypeFix
- getTypeIndex :: Type -> State HieTypeState TypeIndex
- resolveTyVarScopes :: Map HiePath (HieAST a) -> Map HiePath (HieAST a)
- resolveTyVarScopeLocal :: HieAST a -> Map HiePath (HieAST a) -> HieAST a
- getNameBinding :: Name -> Map HiePath (HieAST a) -> Maybe Span
- getNameScope :: Name -> Map HiePath (HieAST a) -> Maybe [Scope]
- getNameBindingInClass :: Name -> Span -> Map HiePath (HieAST a) -> Maybe Span
- getNameScopeAndBinding :: Name -> Map HiePath (HieAST a) -> Maybe ([Scope], Maybe Span)
- getScopeFromContext :: ContextInfo -> Maybe [Scope]
- getBindSiteFromContext :: ContextInfo -> Maybe Span
- flattenAst :: HieAST a -> [HieAST a]
- smallestContainingSatisfying :: Span -> (HieAST a -> Bool) -> HieAST a -> Maybe (HieAST a)
- selectLargestContainedBy :: Span -> HieAST a -> Maybe (HieAST a)
- selectSmallestContaining :: Span -> HieAST a -> Maybe (HieAST a)
- definedInAsts :: Map HiePath (HieAST a) -> Name -> Bool
- getEvidenceBindDeps :: ContextInfo -> [Name]
- isEvidenceBind :: ContextInfo -> Bool
- isEvidenceContext :: ContextInfo -> Bool
- isEvidenceUse :: ContextInfo -> Bool
- isOccurrence :: ContextInfo -> Bool
- scopeContainsSpan :: Scope -> Span -> Bool
- combineAst :: HieAST Type -> HieAST Type -> HieAST Type
- insertAst :: HieAST Type -> [HieAST Type] -> [HieAST Type]
- nodeInfo :: HieAST Type -> NodeInfo Type
- emptyNodeInfo :: NodeInfo a
- sourcedNodeIdents :: SourcedNodeInfo a -> NodeIdentifiers a
- combineSourcedNodeInfo :: SourcedNodeInfo Type -> SourcedNodeInfo Type -> SourcedNodeInfo Type
- combineNodeInfo :: NodeInfo Type -> NodeInfo Type -> NodeInfo Type
- mergeAsts :: [HieAST Type] -> [HieAST Type] -> [HieAST Type]
- rightOf :: Span -> Span -> Bool
- leftOf :: Span -> Span -> Bool
- startsRightOf :: Span -> Span -> Bool
- mergeSortAsts :: [HieAST Type] -> [HieAST Type]
- simpleNodeInfo :: FastString -> FastString -> NodeInfo a
- locOnly :: Monad m => SrcSpan -> ReaderT NodeOrigin m [HieAST a]
- mkScopeA :: SrcSpanAnn' ann -> Scope
- mkScope :: SrcSpan -> Scope
- mkLScope :: Located a -> Scope
- mkLScopeA :: GenLocated (SrcSpanAnn' a) e -> Scope
- mkLScopeN :: LocatedN a -> Scope
- combineScopes :: Scope -> Scope -> Scope
- mkSourcedNodeInfo :: NodeOrigin -> NodeInfo a -> SourcedNodeInfo a
- makeNodeA :: (Monad m, Data a) => a -> SrcSpanAnn' ann -> ReaderT NodeOrigin m [HieAST b]
- makeNode :: (Monad m, Data a) => a -> SrcSpan -> ReaderT NodeOrigin m [HieAST b]
- makeTypeNodeA :: (Monad m, Data a) => a -> SrcSpanAnnA -> Type -> ReaderT NodeOrigin m [HieAST Type]
- makeTypeNode :: (Monad m, Data a) => a -> SrcSpan -> Type -> ReaderT NodeOrigin m [HieAST Type]
Documentation
type RefMap a = Map Identifier [(Span, IdentifierDetails a)] Source #
renderHieType :: DynFlags -> HieTypeFix -> String Source #
foldType :: (HieType a -> a) -> HieTypeFix -> a Source #
findEvidenceUse :: NodeIdentifiers a -> [Name] Source #
data EvidenceInfo a Source #
Constructors
EvidenceInfo | |
Fields
|
Instances
Functor EvidenceInfo # | |
Defined in GHC.Iface.Ext.Utils Methods fmap :: (a -> b) -> EvidenceInfo a -> EvidenceInfo b Source # (<$) :: a -> EvidenceInfo b -> EvidenceInfo a Source # | |
Outputable a => Outputable (EvidenceInfo a) # | |
Defined in GHC.Iface.Ext.Utils Methods ppr :: EvidenceInfo a -> SDoc Source # | |
Eq a => Eq (EvidenceInfo a) # | |
Defined in GHC.Iface.Ext.Utils Methods (==) :: EvidenceInfo a -> EvidenceInfo a -> Bool # (/=) :: EvidenceInfo a -> EvidenceInfo a -> Bool # | |
Ord a => Ord (EvidenceInfo a) # | |
Defined in GHC.Iface.Ext.Utils Methods compare :: EvidenceInfo a -> EvidenceInfo a -> Ordering # (<) :: EvidenceInfo a -> EvidenceInfo a -> Bool # (<=) :: EvidenceInfo a -> EvidenceInfo a -> Bool # (>) :: EvidenceInfo a -> EvidenceInfo a -> Bool # (>=) :: EvidenceInfo a -> EvidenceInfo a -> Bool # max :: EvidenceInfo a -> EvidenceInfo a -> EvidenceInfo a # min :: EvidenceInfo a -> EvidenceInfo a -> EvidenceInfo a # |
getEvidenceTreesAtPoint :: HieFile -> RefMap a -> (Int, Int) -> Forest (EvidenceInfo a) Source #
getEvidenceTree :: RefMap a -> Name -> Maybe (Tree (EvidenceInfo a)) Source #
hieTypeToIface :: HieTypeFix -> IfaceType Source #
data HieTypeState Source #
Constructors
HTS | |
Fields
|
compressTypes :: HieASTs Type -> (HieASTs TypeIndex, Array TypeIndex HieTypeFlat) Source #
getScopeFromContext :: ContextInfo -> Maybe [Scope] Source #
flattenAst :: HieAST a -> [HieAST a] Source #
getEvidenceBindDeps :: ContextInfo -> [Name] Source #
isEvidenceBind :: ContextInfo -> Bool Source #
isEvidenceContext :: ContextInfo -> Bool Source #
isEvidenceUse :: ContextInfo -> Bool Source #
isOccurrence :: ContextInfo -> Bool Source #
combineAst :: HieAST Type -> HieAST Type -> HieAST Type Source #
One must contain the other. Leaf nodes cannot contain anything
insertAst :: HieAST Type -> [HieAST Type] -> [HieAST Type] Source #
Insert an AST in a sorted list of disjoint Asts
emptyNodeInfo :: NodeInfo a Source #
sourcedNodeIdents :: SourcedNodeInfo a -> NodeIdentifiers a Source #
combineSourcedNodeInfo :: SourcedNodeInfo Type -> SourcedNodeInfo Type -> SourcedNodeInfo Type Source #
combineNodeInfo :: NodeInfo Type -> NodeInfo Type -> NodeInfo Type Source #
Merge two nodes together.
Precondition and postcondition: elements in nodeType
are ordered.
mergeAsts :: [HieAST Type] -> [HieAST Type] -> [HieAST Type] Source #
Merge two sorted, disjoint lists of ASTs, combining when necessary.
In the absence of position-altering pragmas (ex: # line "file.hs" 3
),
different nodes in an AST tree should either have disjoint spans (in
which case you can say for sure which one comes first) or one span
should be completely contained in the other (in which case the contained
span corresponds to some child node).
However, since Haskell does have position-altering pragmas it is
possible for spans to be overlapping. Here is an example of a source file
in which foozball
and quuuuuux
have overlapping spans:
module Baz where # line 3 "Baz.hs" foozball :: Int foozball = 0 # line 3 "Baz.hs" bar, quuuuuux :: Int bar = 1 quuuuuux = 2
In these cases, we just do our best to produce sensible HieAST
's. The blame
should be laid at the feet of whoever wrote the line pragmas in the first place
(usually the C preprocessor...).
simpleNodeInfo :: FastString -> FastString -> NodeInfo a Source #
mkScopeA :: SrcSpanAnn' ann -> Scope Source #
mkLScopeA :: GenLocated (SrcSpanAnn' a) e -> Scope Source #
mkSourcedNodeInfo :: NodeOrigin -> NodeInfo a -> SourcedNodeInfo a Source #
Arguments
:: (Monad m, Data a) | |
=> a | helps fill in |
-> SrcSpanAnn' ann | return an empty list if this is unhelpful |
-> ReaderT NodeOrigin m [HieAST b] |
Arguments
:: (Monad m, Data a) | |
=> a | helps fill in |
-> SrcSpan | return an empty list if this is unhelpful |
-> ReaderT NodeOrigin m [HieAST b] |
Arguments
:: (Monad m, Data a) | |
=> a | helps fill in |
-> SrcSpanAnnA | return an empty list if this is unhelpful |
-> Type | type to associate with the node |
-> ReaderT NodeOrigin m [HieAST Type] |
Arguments
:: (Monad m, Data a) | |
=> a | helps fill in |
-> SrcSpan | return an empty list if this is unhelpful |
-> Type | type to associate with the node |
-> ReaderT NodeOrigin m [HieAST Type] |