summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Language/Haskell/Stylish/Step/Imports.hs2
-rw-r--r--tests/Language/Haskell/Stylish/Step/Imports/Tests.hs26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/Language/Haskell/Stylish/Step/Imports.hs b/src/Language/Haskell/Stylish/Step/Imports.hs
index b1f2bd9..fa1b3ff 100644
--- a/src/Language/Haskell/Stylish/Step/Imports.hs
+++ b/src/Language/Haskell/Stylish/Step/Imports.hs
@@ -165,7 +165,7 @@ prettyImport columns Align{..} padQualified padName longest imp =
then padRight longest
else id
- padImportNoSpec = if isJust (H.importAs imp) || hasHiding
+ padImportNoSpec = if (isJust (H.importAs imp) || hasHiding) && padName
then padRight longest
else id
diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
index 2062fe0..95f003e 100644
--- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
+++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
@@ -41,6 +41,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests"
, testCase "case 12" case12
, testCase "case 13" case13
, testCase "case 14" case14
+ , testCase "case 15" case15
]
@@ -336,3 +337,28 @@ case14 = expected
expected = unlines
[ "import qualified Data.List as List (concat, map, null, reverse, tail, (++))"
]
+
+--------------------------------------------------------------------------------
+case15 :: Assertion
+case15 = expected
+ @=? testStep (step 80 $ Align None AfterAlias Multiline 4) input'
+ where
+ expected = unlines
+ [ "import Data.Acid (AcidState)"
+ , "import qualified Data.Acid as Acid"
+ , " ( closeAcidState"
+ , " , createCheckpoint"
+ , " , openLocalStateFrom"
+ , " )"
+ , "import Data.Default.Class (Default (def))"
+ , ""
+ , "import qualified Herp.Derp.Internal.Types.Foobar as Internal (bar, foo)"
+ ]
+
+ input' = unlines
+ [ "import Data.Acid (AcidState)"
+ , "import qualified Data.Acid as Acid (closeAcidState, createCheckpoint, openLocalStateFrom)"
+ , "import Data.Default.Class (Default (def))"
+ , ""
+ , "import qualified Herp.Derp.Internal.Types.Foobar as Internal (foo, bar)"
+ ]