fourmolu-0.15.0.0: A formatter for Haskell source code
Safe HaskellSafe-Inferred
LanguageGHC2021

Ormolu.Utils

Description

Random utilities used by the code.

Synopsis

Documentation

data RelativePos Source #

Relative positions in a list.

Instances

Instances details
Show RelativePos Source # 
Instance details

Defined in Ormolu.Utils

Eq RelativePos Source # 
Instance details

Defined in Ormolu.Utils

attachRelativePos :: [a] -> [(RelativePos, a)] Source #

Attach RelativePoses to elements of a given list.

combineSrcSpans' :: NonEmpty SrcSpan -> SrcSpan Source #

Combine all source spans from the given list.

notImplemented :: String -> a Source #

Placeholder for things that are not yet implemented.

showOutputable :: Outputable o => o -> String Source #

Pretty-print an Outputable thing.

splitDocString :: Bool -> HsDocString -> [Text] Source #

Split and normalize a doc string. The result is a list of lines that make up the comment.

incSpanLine :: Int -> SrcSpan -> SrcSpan Source #

Increment line number in a SrcSpan.

separatedByBlank :: (a -> SrcSpan) -> a -> a -> Bool Source #

Do two declarations have a blank between them?

separatedByBlankNE :: (a -> SrcSpan) -> NonEmpty a -> NonEmpty a -> Bool Source #

Do two declaration groups have a blank between them?

onTheSameLine :: SrcSpan -> SrcSpan -> Bool Source #

Return True if one span ends on the same line the second one starts.

groupBy' :: (a -> a -> Bool) -> [a] -> [NonEmpty a] Source #

A generalisation of groupBy to functions which aren't equivalences - a group ends when comparison fails with the previous element, rather than the first of the group.

class HasSrcSpan l where Source #

Methods

loc' :: l -> SrcSpan Source #

Instances

Instances details
HasSrcSpan RealSrcSpan Source # 
Instance details

Defined in Ormolu.Utils

HasSrcSpan SrcSpan Source # 
Instance details

Defined in Ormolu.Utils

Methods

loc' :: SrcSpan -> SrcSpan Source #

HasSrcSpan (SrcSpanAnn' ann) Source # 
Instance details

Defined in Ormolu.Utils

Methods

loc' :: SrcSpanAnn' ann -> SrcSpan Source #

matchAddEpAnn :: AnnKeywordId -> AddEpAnn -> Maybe EpaLocation Source #

Check whether the given AnnKeywordId or its Unicode variant is in an AddEpAnn, and return the EpaLocation if so.

textToStringBuffer :: Text -> StringBuffer Source #

Convert Text to a StringBuffer by making a copy.

ghcModuleNameToCabal :: ModuleName -> ModuleName Source #

Convert GHC's ModuleName into the one used by Cabal.