ghc-exactprint-1.7.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

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.

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

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

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.

cmpComments :: Comment -> Comment -> Ordering Source #

Must compare without span filenames, for CPP injected comments with fake filename

sortComments :: [Comment] -> [Comment] Source #

Sort, comparing without span filenames, for CPP injected comments with fake filename

sortEpaComments :: [LEpaComment] -> [LEpaComment] Source #

Sort, comparing without span filenames, for CPP injected comments with fake filename

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

Makes a comment which originates from a specific keyword.

isKWComment :: Comment -> Bool Source #

Detects a comment which originates from a specific keyword.

dpFromString :: String -> DeltaPos Source #

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

moveAnchor :: Monoid b => SrcAnn a -> SrcAnn b Source #

Version of l2l that preserves the anchor, immportant if it has an updated AnchorOperation