ghc-9.2.3: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Iface.Ext.Utils

Synopsis

Documentation

foldType :: (HieType a -> a) -> HieTypeFix -> a Source #

data EvidenceInfo a Source #

Instances

Instances details
Functor EvidenceInfo Source # 
Instance details

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) Source # 
Instance details

Defined in GHC.Iface.Ext.Utils

Methods

ppr :: EvidenceInfo a -> SDoc Source #

Eq a => Eq (EvidenceInfo a) Source # 
Instance details

Defined in GHC.Iface.Ext.Utils

Ord a => Ord (EvidenceInfo a) Source # 
Instance details

Defined in GHC.Iface.Ext.Utils

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

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...).

mergeSortAsts :: [HieAST Type] -> [HieAST Type] Source #

combines and sorts ASTs using a merge sort

makeNodeA Source #

Arguments

:: (Monad m, Data a) 
=> a

helps fill in nodeAnnotations (with Data)

-> SrcSpanAnn' ann

return an empty list if this is unhelpful

-> ReaderT NodeOrigin m [HieAST b] 

makeNode Source #

Arguments

:: (Monad m, Data a) 
=> a

helps fill in nodeAnnotations (with Data)

-> SrcSpan

return an empty list if this is unhelpful

-> ReaderT NodeOrigin m [HieAST b] 

makeTypeNodeA Source #

Arguments

:: (Monad m, Data a) 
=> a

helps fill in nodeAnnotations (with Data)

-> SrcSpanAnnA

return an empty list if this is unhelpful

-> Type

type to associate with the node

-> ReaderT NodeOrigin m [HieAST Type] 

makeTypeNode Source #

Arguments

:: (Monad m, Data a) 
=> a

helps fill in nodeAnnotations (with Data)

-> SrcSpan

return an empty list if this is unhelpful

-> Type

type to associate with the node

-> ReaderT NodeOrigin m [HieAST Type]