Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Random utilities used by the code.
Synopsis
- data RelativePos
- attachRelativePos :: [a] -> [(RelativePos, a)]
- combineSrcSpans' :: NonEmpty SrcSpan -> SrcSpan
- notImplemented :: String -> a
- showOutputable :: Outputable o => o -> String
- splitDocString :: Bool -> HsDocString -> [Text]
- incSpanLine :: Int -> SrcSpan -> SrcSpan
- separatedByBlank :: (a -> SrcSpan) -> a -> a -> Bool
- separatedByBlankNE :: (a -> SrcSpan) -> NonEmpty a -> NonEmpty a -> Bool
- onTheSameLine :: SrcSpan -> SrcSpan -> Bool
- groupBy' :: (a -> a -> Bool) -> [a] -> [NonEmpty a]
- class HasSrcSpan l where
- getLoc' :: HasSrcSpan l => GenLocated l a -> SrcSpan
- matchAddEpAnn :: AnnKeywordId -> AddEpAnn -> Maybe EpaLocation
- textToStringBuffer :: Text -> StringBuffer
- ghcModuleNameToCabal :: ModuleName -> ModuleName
Documentation
data RelativePos Source #
Relative positions in a list.
Instances
Show RelativePos Source # | |
Defined in Ormolu.Utils showsPrec :: Int -> RelativePos -> ShowS # show :: RelativePos -> String # showList :: [RelativePos] -> ShowS # | |
Eq RelativePos Source # | |
Defined in Ormolu.Utils (==) :: RelativePos -> RelativePos -> Bool # (/=) :: RelativePos -> RelativePos -> Bool # |
attachRelativePos :: [a] -> [(RelativePos, a)] Source #
Attach RelativePos
es 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.
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 #
Instances
HasSrcSpan RealSrcSpan Source # | |
Defined in Ormolu.Utils loc' :: RealSrcSpan -> SrcSpan Source # | |
HasSrcSpan SrcSpan Source # | |
HasSrcSpan (SrcSpanAnn' ann) Source # | |
Defined in Ormolu.Utils loc' :: SrcSpanAnn' ann -> SrcSpan Source # |
getLoc' :: HasSrcSpan l => GenLocated l a -> 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.