stylish-haskell-0.14.4.0: Haskell code prettifier
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Haskell.Stylish.Module

Synopsis

Data types

type Module = Located HsModule Source #

Concrete module type

newtype Comments Source #

Comments associated with module

type Lines = [String] Source #

Getters

moduleImportGroups :: Module -> [NonEmpty (LImportDecl GhcPs)] Source #

Get groups of imports from module

queryModule :: Typeable a => (a -> [b]) -> Module -> [b] Source #

Query the module AST using f

groupByLine :: (a -> RealSrcSpan) -> [a] -> [NonEmpty a] Source #

Imports

canMergeImport :: ImportDecl GhcPs -> ImportDecl GhcPs -> Bool Source #

Returns true if the two import declarations can be merged

mergeModuleImport :: LImportDecl GhcPs -> LImportDecl GhcPs -> LImportDecl GhcPs Source #

Merge two import declarations, keeping positions from the first

As alluded, this highlights an issue with merging imports. The GHC annotation comments aren't attached to any particular AST node. This means that right now, we're manually reconstructing the attachment. By merging two import declarations, we lose that mapping.

It's not really a big deal if we consider that people don't usually comment imports themselves. It _is_ however, systemic and it'd be better if we processed comments beforehand and attached them to all AST nodes in our own representation.

Pragmas

Orphan instances

Eq RawPkgQual Source # 
Instance details