Moduleghc-9.10.3GHC2021
GHC.Iface.Ext.Utils
- 3 types
- 55 values
- Packageghc-9.10.3
- Exports58
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceUtils.hs
Constructors
Instances4Functor, Eq, Ord, Outputable
Functor EvidenceInfoDefined in ghc-9.10.3 · GHC.Iface.Ext.UtilsEq a => Eq (EvidenceInfo a)Defined in ghc-9.10.3 · GHC.Iface.Ext.UtilsOrd a => Ord (EvidenceInfo a)Defined in ghc-9.10.3 · GHC.Iface.Ext.UtilsOutputable a => Outputable (EvidenceInfo a)Defined in ghc-9.10.3 · GHC.Iface.Ext.Utils
Constructors
HTStyMap :: !TypeMap TypeIndexhtyTable :: !IntMap HieTypeFlatfreshIndex :: !TypeIndex
One must contain the other. Leaf nodes cannot contain anything
Insert an AST in a sorted list of disjoint Asts
Merge two nodes together.
Precondition and postcondition: elements in nodeType are ordered.
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...).
combines and sorts ASTs using a merge sort
makeNodeA :: (Monad m, Data a)=> ahelps fill in nodeAnnotations (with Data)
-> EpAnn annreturn an empty list if this is unhelpful
-> ReaderT NodeOrigin m [HieAST b]
makeNode :: (Monad m, Data a)=> ahelps fill in nodeAnnotations (with Data)
-> SrcSpanreturn an empty list if this is unhelpful
-> ReaderT NodeOrigin m [HieAST b]
makeTypeNodeA :: (Monad m, Data a)=> ahelps fill in nodeAnnotations (with Data)
-> SrcSpanAnnAreturn an empty list if this is unhelpful
-> Typetype to associate with the node
-> ReaderT NodeOrigin m [HieAST Type]
makeTypeNode :: (Monad m, Data a)=> ahelps fill in nodeAnnotations (with Data)
-> SrcSpanreturn an empty list if this is unhelpful
-> Typetype to associate with the node
-> ReaderT NodeOrigin m [HieAST Type]