summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-09-20 09:02:09 +0900
committerJasper Van der Jeugt <m@jaspervdj.be>2012-09-20 09:02:09 +0900
commita0f61c5e145361b1910aa9ad71783370efbccc51 (patch)
tree1383e67df8c18d3d5c18af160dabae3ac522c7c4
parent34ec8bc060b0f96962eeeaf15823e8af6df5177e (diff)
downloadstylish-haskell-a0f61c5e145361b1910aa9ad71783370efbccc51.tar.gz
Delay joining of long import lines
Fixes #15
-rw-r--r--src/Language/Haskell/Stylish/Step/Imports.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Language/Haskell/Stylish/Step/Imports.hs b/src/Language/Haskell/Stylish/Step/Imports.hs
index fc14256..ea0b8a4 100644
--- a/src/Language/Haskell/Stylish/Step/Imports.hs
+++ b/src/Language/Haskell/Stylish/Step/Imports.hs
@@ -108,9 +108,8 @@ prettyImportSpec x = H.prettyPrint x
--------------------------------------------------------------------------------
-prettyImport :: Int -> Bool -> Bool -> Int -> H.ImportDecl l -> String
+prettyImport :: Int -> Bool -> Bool -> Int -> H.ImportDecl l -> [String]
prettyImport columns padQualified padName longest imp =
- intercalate "\n" $
wrap columns base (length base + 2) $
(if hiding then ("hiding" :) else id) $
withInit (++ ",") $
@@ -143,7 +142,7 @@ prettyImport columns padQualified padName longest imp =
--------------------------------------------------------------------------------
prettyImportGroup :: Int -> Align -> Int -> [H.ImportDecl LineBlock] -> Lines
prettyImportGroup columns align longest imps =
- map (prettyImport columns padQual padName longest') $
+ concatMap (prettyImport columns padQual padName longest') $
sortBy compareImports imps
where
longest' = case align of