diff options
Diffstat (limited to 'lib/Language/Haskell/Stylish/Step/Imports.hs')
-rw-r--r-- | lib/Language/Haskell/Stylish/Step/Imports.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Language/Haskell/Stylish/Step/Imports.hs b/lib/Language/Haskell/Stylish/Step/Imports.hs index f2439dc..b89d73f 100644 --- a/lib/Language/Haskell/Stylish/Step/Imports.hs +++ b/lib/Language/Haskell/Stylish/Step/Imports.hs @@ -11,6 +11,8 @@ module Language.Haskell.Stylish.Step.Imports , EmptyListAlign (..) , ListPadding (..) , step + + , printImport ) where -------------------------------------------------------------------------------- @@ -213,7 +215,7 @@ printQualified Options{..} padNames stats (L _ decl) = do _ -> space >> putText "()" Just (L _ imports) -> do let printedImports = flagEnds $ -- [P ()] - fmap ((printImport Options{..}) . unLocated) + fmap ((printImport separateLists) . unLocated) (prepareImportList imports) -- Since we might need to output the import module name several times, we @@ -308,18 +310,20 @@ printQualified Options{..} padNames stats (L _ decl) = do -------------------------------------------------------------------------------- -printImport :: Options -> IE GhcPs -> P () +printImport :: Bool -> IE GhcPs -> P () printImport _ (IEVar _ name) = do printIeWrappedName name printImport _ (IEThingAbs _ name) = do printIeWrappedName name -printImport Options{..} (IEThingAll _ name) = do +printImport separateLists (IEThingAll _ name) = do printIeWrappedName name when separateLists space putText "(..)" printImport _ (IEModuleContents _ (L _ m)) = do + putText "module" + space putText (moduleNameString m) -printImport Options{..} (IEThingWith _ name _wildcard imps _) = do +printImport separateLists (IEThingWith _ name _wildcard imps _) = do printIeWrappedName name when separateLists space parenthesize $ @@ -333,6 +337,7 @@ printImport _ (IEDocNamed _ _) = printImport _ (XIE ext) = GHC.noExtCon ext + -------------------------------------------------------------------------------- printIeWrappedName :: LIEWrappedName RdrName -> P () printIeWrappedName lie = unLocated lie & \case |