Safe Haskell | None |
---|---|
Language | Haskell2010 |
- annotateLHsModule :: Located (HsModule RdrName) -> ApiAnns -> Anns
- organiseAnns :: Anns -> OrganisedAnns
- type OrganisedAnns = Map SrcSpan ([(AnnConName, Annotation)], [(KeywordId, [DeltaPos])])
- ghcIsMultiLine :: Located AnnotationComment -> Bool
- srcSpanStartLine :: SrcSpan -> Int
- srcSpanEndLine :: SrcSpan -> Int
- srcSpanStartColumn :: SrcSpan -> Int
- srcSpanEndColumn :: SrcSpan -> Int
- ss2span :: SrcSpan -> Span
- ss2pos :: SrcSpan -> Pos
- ss2posEnd :: SrcSpan -> Pos
- undelta :: Pos -> DeltaPos -> Int -> Pos
- undeltaComment :: Pos -> Int -> DComment -> Comment
- isGoodDelta :: DeltaPos -> Bool
- rdrName2String :: RdrName -> String
- isSymbolRdrName :: RdrName -> Bool
- isListComp :: HsStmtContext name -> Bool
- showGhc :: Outputable a => a -> String
- showAnnData :: Data a => OrganisedAnns -> Int -> a -> String
- merge :: Ord a => [a] -> [a] -> [a]
- debug :: c -> String -> c
- runAP :: AP () -> ApiAnns -> Anns
- newtype AP x = AP ([(SrcSpan, AnnConName)] -> SrcSpan -> Extra -> ApiAnns -> (x, [(SrcSpan, AnnConName)], SrcSpan, Extra, ApiAnns, ([(AnnKey, Annotation)], [(AnnKeyF, [DeltaPos])])))
- getSrcSpanAP :: AP SrcSpan
- pushSrcSpanAP :: Data a => Located a -> AP ()
- popSrcSpanAP :: AP ()
- getAnnotationAP :: SrcSpan -> AnnKeywordId -> AP [SrcSpan]
- addAnnotationsAP :: Annotation -> AP ()
- ghead :: String -> [a] -> a
- glast :: String -> [a] -> a
- gtail :: String -> [a] -> [a]
- gfromJust :: [Char] -> Maybe a -> a
Documentation
organiseAnns :: Anns -> OrganisedAnns Source
Re-arrange the annotations to make it clearer for users how they hang together.
type OrganisedAnns = Map SrcSpan ([(AnnConName, Annotation)], [(KeywordId, [DeltaPos])]) Source
For debugging
srcSpanStartLine :: SrcSpan -> Int Source
srcSpanEndLine :: SrcSpan -> Int Source
srcSpanStartColumn :: SrcSpan -> Int Source
srcSpanEndColumn :: SrcSpan -> Int Source
undelta :: Pos -> DeltaPos -> Int -> Pos Source
Apply the delta to the current position, taking into account the current column offset
undeltaComment :: Pos -> Int -> DComment -> Comment Source
Apply the delta to the current position, taking into account the current column offset
isGoodDelta :: DeltaPos -> Bool Source
rdrName2String :: RdrName -> String Source
isSymbolRdrName :: RdrName -> Bool Source
isListComp :: HsStmtContext name -> Bool Source
showGhc :: Outputable a => a -> String Source
Show a GHC API structure
showAnnData :: Data a => OrganisedAnns -> Int -> a -> String Source
merge :: Ord a => [a] -> [a] -> [a] Source
Merge two sorted lists into a single, sorted whole.
Example:
merge [1,3,5] [1,2,4,6] -> [1,1,2,3,4,5,6]
QuickCheck test property:
prop_merge xs ys = merge (sort xs) (sort ys) == sort (xs ++ ys) where types = xs :: [Int]
For tests
Type used in the AP Monad. The state variables maintain - the current SrcSpan and the constructor of the thing it encloses as a stack to the root of the AST as it is traversed, - the srcspan of the last thing annotated, to calculate delta's from - extra data needing to be stored in the monad - the annotations provided by GHC
AP ([(SrcSpan, AnnConName)] -> SrcSpan -> Extra -> ApiAnns -> (x, [(SrcSpan, AnnConName)], SrcSpan, Extra, ApiAnns, ([(AnnKey, Annotation)], [(AnnKeyF, [DeltaPos])]))) |
getSrcSpanAP :: AP SrcSpan Source
Note: assumes the SrcSpan stack is nonempty
pushSrcSpanAP :: Data a => Located a -> AP () Source
popSrcSpanAP :: AP () Source
getAnnotationAP :: SrcSpan -> AnnKeywordId -> AP [SrcSpan] Source
addAnnotationsAP :: Annotation -> AP () Source
Add some annotation to the currently active SrcSpan