ghc-exactprint-1.1.0: ExactPrint for GHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Haskell.GHC.ExactPrint.Utils

Synopsis

Documentation

debugEnabledFlag :: Bool Source #

Global switch to enable debug tracing in ghc-exactprint Delta / Print

debugPEnabledFlag :: Bool Source #

Global switch to enable debug tracing in ghc-exactprint Pretty

debug :: c -> String -> c Source #

Provide a version of trace that comes at the end of the line, so it can easily be commented out when debugging different things.

debugP :: String -> c -> c Source #

Provide a version of trace for the Pretty module, which can be enabled separately from debug and debugM

debugM :: Monad m => String -> m () Source #

warn :: c -> String -> c Source #

isGoodDelta :: DeltaPos -> Bool Source #

A good delta has no negative values.

ss2delta :: Pos -> RealSrcSpan -> DeltaPos Source #

Create a delta from the current position to the start of the given SrcSpan.

ss2deltaEnd :: RealSrcSpan -> RealSrcSpan -> DeltaPos Source #

create a delta from the end of a current span. The +1 is because the stored position ends up one past the span, this is prior to that adjustment

ss2deltaStart :: RealSrcSpan -> RealSrcSpan -> DeltaPos Source #

create a delta from the start of a current span. The +1 is because the stored position ends up one past the span, this is prior to that adjustment

pos2delta :: Pos -> Pos -> DeltaPos Source #

Convert the start of the second Pos to be an offset from the first. The assumption is the reference starts before the second Pos

undelta :: Pos -> DeltaPos -> LayoutStartCol -> Pos Source #

Apply the delta to the current position, taking into account the current column offset if advancing to a new line

addDP :: DeltaPos -> DeltaPos -> DeltaPos Source #

Add together two DeltaPos taking into account newlines

DP (0, 1) `addDP` DP (0, 2) == DP (0, 3)
DP (0, 9) `addDP` DP (1, 5) == DP (1, 5)
DP (1, 4) `addDP` DP (1, 3) == DP (2, 3)

isPointSrcSpan :: RealSrcSpan -> Bool Source #

Checks whether a SrcSpan has zero length.

orderByKey :: [(RealSrcSpan, a)] -> [RealSrcSpan] -> [(RealSrcSpan, a)] Source #

Given a list of items and a list of keys, returns a list of items ordered by their position in the list of keys.

isExactName :: Data name => name -> Bool Source #

mkKWComment :: AnnKeywordId -> EpaLocation -> Comment Source #

Makes a comment which originates from a specific keyword.

annTrueEntryDelta :: Annotation -> DeltaPos Source #

The "true entry" is the distance from the last concrete element to the start of the current element.

annLeadingCommentEntryDelta :: Annotation -> DeltaPos Source #

Return the DP of the first item that generates output, either a comment or the entry DP

dpFromString :: String -> DeltaPos Source #

Calculates the distance from the start of a string to the end of a string.

showAst :: Data a => a -> String Source #

ghead :: String -> [a] -> a Source #

glast :: String -> [a] -> a Source #

gtail :: String -> [a] -> [a] Source #